Hello
Help me please
I used wp_insert_post to create new post in cpt
what needs to be sent to the field “meta_input” add to Map jQuery in ACF?
I want to immediately select a location on the map. Is it possible?
My code like this dont work
$advert_address= $_POST[‘advert_address’];
$advert_new = [
‘ID’ => ”,
‘post_type’ => ‘offers’,
‘meta_input’ => [
‘map’ => $advert_address,
'_map' => 'field_616dc311ccd7f'
],
‘post_content’ => $advert_desc,
‘post_title’ => $advert_title,
‘post_status’ => ‘pending’
];
$post_id = wp_insert_post($advert_new);
I cannot tell you exactly what needs to be added because I don’t have any sites that use google maps. But I can tell you how to find what you want to know.
1) Edit a post and add a map
2) Examine your database wp_postmeta table and find the meta value for the field
This will tell you exactly what needs to be in that field.
From previous topics I know this is an array and that you must connect to the google map API to get the data for the address.
https://www.google.com/search?q=acf+update+google+maps+field+from+PHP+site:support.advancedcustomfields.com&client=firefox-b-1-d&sa=X&ved=2ahUKEwjLipzI7470AhXBQs0KHam_AdIQrQIoBHoECBMQBQ