Open
Description
I've created a post type with some dropdown fields. One for user, one referencing another post type (user and post field types).

Here is an example of how I'm mapping the ids from my source file using WPAI with the extension:

My observation is that the id is saved as a serialized array into postmeta. When I go into the UI and click save, it saves as numbers and eliminates the array.
I have worked around this issue by hooking into pmxi_saved_post.
add_action( 'pmxi_saved_post', function( $post_id, $xml_node, $is_update ) {
$user = get_post_meta( $post_id, 'user_field', true );
$post = get_post_meta( $post_id, 'post_field', true );
if (is_array($user)) {
$user = $user[0];
rwmb_set_meta( $post_id, 'user_field', $user );
}
if (is_array($post)) {
$related = $related[0];
rwmb_set_meta( $post_id, 'post_field', $related );
}
}, 10, 3);
Metadata
Metadata
Assignees
Labels
No labels