Home › Forums › ACF PRO › Is it possible to programmatically update a google map acf by lat/lang? › Reply To: Is it possible to programmatically update a google map acf by lat/lang?
You are using WP all import, as I said, if you have the ACF extension for this plugin then it will handle the import for you and then there is no need to call any ACF function.
If you want to do this yourself then
update_field() https://www.advancedcustomfields.com/resources/update_field/ would be used, just like any other field. Make sure to read the important notes about using the field key vs. the field name when updating fields that do not exist. The value for using this function would be a value that matches what ACF normally stores in the database. In the case of a GM field it would be an array. Exactly what needs to be in the array I can’t really answer, I’ve never used a GM field or needed to update them if I did. You can figure this out by saving a value to a map field and looking at the value that is stored in the database, or you can run a test on the front end of the site.
echo '<pre>'; print_r(get_field('your-field-name', false, false)); echo '</pre>';
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!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.