Custom Fields CSV Import Question
I've posted about this before but I need to ask again.
If you enter a listing via the admin or front end and that listing has a custom field which is a multiple checkbox, each ticked value gets stored separately in wp_postsmeta (and that's fantastic).
If I import a CSV that includes that custom field with multiple values separated by commas, my listing gets imported but I only have one row on wp_postmeta with all my custom field values strung together. For the purposes of my listing display, I NEED these two methods of data entry to behave in the same way.
I *think* the answer is in my child them functions.php , where I have this function:
Code:
function aspph_custom_csv_fields( $args )
{
$args['custom_fields']['price'] = array( 'internal_key' => 'app_price' );
$args['custom_fields']['specialoffers'] = array( 'internal_key' => 'app_special-offers' );
$args['custom_fields']['contactemailaddress'] = array( 'internal_key' => 'app_business-owner-email-address' );
$args['custom_fields']['day'] = array( 'internal_key' => 'app_day' );
$args['custom_fields']['time'] = array( 'internal_key' => 'app_time' );
$args['custom_fields']['extrainfo'] = array( 'internal_key' => 'app_extra-info' );
$args['custom_fields']['age-group'] = array( 'internal_key' => 'app_age-group' );
return $args;
}
The first 3 $args are standard text field custom fields. The next 4 $args rows relate to multiple checkbox custom fields which allow 'tick all that apply'.
I *think* I need some extra array() code around what I've got there for this to work as expected, but I can't figure it out. I have seen this comment in importer.php but I can't translate that into what I need in my functions.php?
Code:
/*
* Args can have 3 elements:
* 'taxonomies' => array( 'valid', 'taxonomies' ),
* 'custom_fields' => array(
* 'csv_key' => 'internal_key',
* 'csv_key' => array(
* 'internal_key' => 'key',
* 'default' => 'value'
* )
* ),
* 'tax_meta' => array( array( 'tax' => array( 'csv_key' => 'tax_key' ) )
*/
Any clues would be much appreciated...I'm pretty desperate! I'm sure I should be able to figure this out but just can't see it....
Many thanks,
red20