Hi, i’ve use update_field function but the data are not saved correctly, i’ve load my image with wp.uploadFile RPC Query and get the ID METADATA by $response[‘id’] with wp_get_attachment_metadata function; now i’ve create the array containing id, title, caption, url, sizes and so on… after that i’ve this code:
$value = get_field("field_5234c710a5b38", $post_id);
$value[] = $arrayPhoto;
update_field( "field_5234c710a5b38", $arrayPhoto, $post_id );
After that the gallery are empty, into db i see the field into wp_postmeta are different as a manual load, i’ve a metakey gallery (field_5234c710a5b38) with the serialized arrayPhoto (a:13:{i:0;a:9:{s:2:”id”;i:2272;s:3:”alt”;s:0:””;s:5:”title”;s:20:”import_1513072……), into other field generated by wordpress there are a serialized object with the ID of two metakey (_wp_attached_file and _wp_attachment_metadata) with the array of data (a:1:{i:0;s:4:”2182″;}).
How can i fix it?
Thanks
Hi,
i solved it this way:
if( isset($query->query_vars[‘post_type’]) && $query->query_vars[‘post_type’] == ‘acf’ ){
return $query;
}
Thanks for your excellent plugin!