Skip to content

Instantly share code, notes, and snippets.

@hissy
Created April 6, 2015 01:29
Show Gist options
  • Save hissy/d2041481a72510b7f394 to your computer and use it in GitHub Desktop.
Save hissy/d2041481a72510b7f394 to your computer and use it in GitHub Desktop.
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