How to enable custom fields skipping in imports with epl_wpimport_default_skip_fields_list filter
@requires Easy Property Listings Import add-on 2.0
Built into the Importer Add-on is the ability to skip fields during import NO MATTER what the settings are set to. This feature enables imported listings to be able to use the Featured Listing system in Easy Property Listings.
Before if you set a listing as featured in WordPress, when the listing was updated the featured tag was lost.
The add-on has a very easy to use specific filter called:
epl_wpimport_default_skip_fields_list
Any fields added to the array will automatically skip data updating. The default installation has 3 fields assigned to this array.
- property_featured
- property_year_built
- property_owner
Manage your featured listings from WordPress
You can now manage your featured listings in WordPress as this filter is hard coded to ALWAYS skip the Featured property setting.
How to add additional custom fields to the skip array
We have implemented 2 ways to use this filter.
OPTION 1:
Set the fields using the epl_wpimport_default_skip_fields_list filter.
The first way is to add additional fields to your array, for example with a custom function we can add additional fields and manage the extra info from within WordPress and when imported listings are updated your custom data is not removed.
<?php function my_import_skip_fields_filter( $fields ) { $fields[] = 'my_new_field'; $fields[] = 'another_new_field'; // Add more here. return $fields; } add_filter( 'epl_wpimport_default_skip_fields_list', 'my_import_skip_fields_filter' );
Add as many fields as necessary to the array. The above example will ADD your new fields to the existing array so you do not alter the featured listing system.
OPTION 2:
Use the new import option on your custom fields. When using the Easy Property Listings epl_listing_meta_boxes custom field system. You can use the import => preserve option to preserve the field data during import. For example:
All custom fields support this option in the settings array.