01/28/2019 at 11:15 am
#482845
Keymaster
@ Margo
Could be the space in the words is not being liked. Try this:
// Register the custom fields CSV Import mapping options and processing callback.
add_filter( 'cncsv_map_import_fields', 'cncsv_header_name' );
add_action( 'cncsv_import_fields', 'cncsv_process_import', 10, 3 );
function cncsv_header_name( $fields ) {
// The field_id should match exactly the field id used when registering the custom field.
$fields['branch_logo'] = 'Branch Logo';
$fields['marker_location'] = 'Marker Location';
return $fields;
}
function cncsv_process_import( $id, $row, $entry ) {
// The field_id should match exactly the field id used when registering the custom field.
$logo = $entry->arrayPull( $row, 'branch_logo', '' );
$logo = cnFormatting::maybeJSONdecode( stripslashes( $logo ) );
$marker = $entry->arrayPull( $row, 'marker_location', '' );
$marker = cnFormatting::maybeJSONdecode( stripslashes( $marker ) );
cnEntry_Action::meta(
'update',
$id,
array(
array(
'key' => 'Branch Logo', // The field_id should match exactly the field id used when registering the custom field.
'value' => $logo
),
array(
'key' => 'Marker Location', // The field_id should match exactly the field id used when registering the custom field.
'value' => $marker
),
)
);
}
