Home › Forums › General Issues › Update google map field › Reply To: Update google map field
Actually yes, but I had to check the database to see how a normal google map mark was being saved, because the google map mark is an array with the address, the latitude and the longitude, so I had to create the array and then send it to the custom field with update_post_meta
$coordinates = getCoordinates($fullAddress); $coordinates = explode(",", $coordinates); $latitude = $coordinates; $longitude = $coordinates; $google_map_mark = array(); array_push($google_map_mark, "address"); array_push($google_map_mark, $fullAddress); array_push($google_map_mark, "lat"); array_push($google_map_mark, $latitude); array_push($google_map_mark, "lng"); array_push($google_map_mark, $longitude); $value = array("address" => $fullAddress, "lat" => $latitude, "lng" => $longitude); update_post_meta($post_id, 'coordinates', $value);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.