Hi,
Could you please share the code which creates the field select_advanced and take some screenshots of the issue?
I will take a closer look and give a quick response.
Regards.
$meta_boxes[] = array(
'id' => $prefix.'relationships',
'title' => 'Options',
'pages' => array( 'pendari_publication'),
'context' => 'normal',
'priority' => 'high' ,
'fields' => array(
...
array(
'name' => 'Authors',
'id' => $prefix . 'related',
'type' => 'post',
'post_type' => 'pendari_people',
'field_type' => 'select_advanced',
'placeholder' => 'Select...',
'desc' => "Contributor to this publication",
'std' => false,
'multiple' => true
),
...
),
);
The content type is for academic publications and we relate them to authors (another custom post type, pendari_people). Everything works when entering data normally.
Using WP All Import to import/update 500+ records saves the other fields properly, but nothing goes into this field for the relationship. I’m not sure if I’m feeding the field the wrong data, using the wrong format or if there’s something else I’m doing wrong.
I don’t think there’s a helpful screenshot since the process runs successfully (no error messages that I can see), but then there’s no data in this field. If you need anything else from me, point me the right direction and I’ll get it for you 🙂
Thank you, Long!!!
Hi,
If you’re going to import/export simple fields (like text, select, radio, checkbox, etc.), you can use these plugins to do the job:
https://ww.wp.xz.cn/plugins/wp-ultimate-csv-importer/
https://ww.wp.xz.cn/plugins/wp-ultimate-exporter/
For complex fields that have a setting 'multiple' => true, we need to code for the integration between Meta Box and WP All Import. It’s on the roadmap and we’re still working on it.
Ah OK, that explains it… I found another post from Nov 2017 where someone asked about this same thing, so I guess it’s a tricky fix. I would love to have this ability since this issue comes up regularly for my team and it would save us many, many hours. Thank you!
I’ll mark this topic as resolved. If you have any further questions, I recommend creating a new thread.
I wanted to tack something on here since I did actually find a way to do this and it might help someone else…
I looked in the wp_postmeta table and saw how the values were saved when I had multiple people related to a single publication (the pendari_publication_related field is in the publication custom post type).
meta_id post_id meta_key meta_value
80286 3902 pendari_publication_related 2411
80290 3902 pendari_publication_related 2316
In my case, post_id is the publication and meta_value is the person (and of course meta_key is the slug of the field). So the mechanism is actually pretty simple and as long as you have the current post_id and the ID of the person, all you need to do is loop through creating DB entries (meta_id is an auto-increment id field).
I had followed the WP All Import add-on API (https://www.wpallimport.com/documentation/addon-dev/overview/) to create a plugin to do a lookup of the person ID on the fly during an import, so then inside that loop, I used WP’s add_post_meta() function to make the DB entries and it built all my relational connections.