Import META Arrays to ACF Checkbox
-
Let us assume you have your CSV ready with a meta field “possibilities”. In the CSV row there is a string …,”possibility_1,possibility_2,possibility_3″,…
Add the following to the functions.php:
add_filter('really_simple_csv_importer_save_meta', 'possibilities_to_array', 10, 3); function possibilities_to_array($meta, $post, $is_update) { ? ? $values = $meta['possibilities']; //string to array ? ? $values = explode(',', $values); ? ? $meta_arr = array(); ? ? foreach ($values as $sub) { //add each to array ? ? ? ? $meta_arr[] = $sub; ? ? } ? ? $meta['possibilities'] = $meta_arr; ? ? return $meta; }
Then run the import. Maybe there are some warnings caused by updating the fields but the posts are set with correct choosen ACF Checkboxes.
Hope it helps!
- The topic ‘Import META Arrays to ACF Checkbox’ is closed to new replies.