Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Divide Meta Fields with Comma (Really Simple CSV Importer add-on)
<?php
/*
Plugin Name: Divide Meta Fields with Comma (Really Simple CSV Importer add-on)
*/
add_filter('really_simple_csv_importer_save_meta', function($meta, $post, $is_update) {
foreach ($meta as $key => $value) {
if (strpos($value, ',') !== false) {
$_value = preg_split("/,+/", $value);
$meta[$key] = $_value;
}
}
return $meta;
}, 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment