Divide Meta Fields with Comma (Really Simple CSV Importer add-on)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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