Home › Forums › Backend Issues (wp-admin) › Google Maps Backend field does not suggest addresses
Hi there,
i was working on localhost for a couple of weeks and google maps backend field worked always fine, now i uploaded the page and face a couple of errors:
1. Typing an address in search field doesn’t make suggestions anymore. Entering an address manually doesn’t show the correct address. It is just grey with a centered pin.
2. For uploaded posts from localhost but changed address in backend on the online page it shows the old maps section, but the new entered address field (1).
So it shows map on frontend with another address added later on, but it doesn’t update, suggest or show it on backend.
Any ideas?
Hi @malv
Could you please make sure that you have set the Google Maps API correctly? Now Google Maps needs you to provide an API key before you can use it on your site. Kindly check this page to learn more about it: https://www.advancedcustomfields.com/resources/google-map/#google-map%20api.
I hope this helps π
Hi @james,
thank you for the answer. Until now i registered my API like that:
wp_register_script('google-maps', 'https://maps.googleapis.com/maps/api/js?key=MYAPIKEY');
wp_register_script('google-jsapi', 'https://www.google.com/jsapi');
wp_enqueue_script('google-maps');
wp_enqueue_script('google-jsapi');
Now i replaced that with your suggestion (iam using PRO):
function my_acf_init() {
acf_update_setting('google_api_key', 'MYAPIKEY');
}
add_action('acf/init', 'my_acf_init');
I didn’t test it on the online system yet, but on my localhost the frontend now only shows white. :/ Was there anything wrong about my old attempt, respectively what is the acf filter doing?
Hi @malv
That code is used only for the Google Map field on the backend. So for the front end, you still need your old code.
I hope this makes sense π
Hi! Im from Russia, and my English not so good, but i hope your can understand me. I have some problems with ACF google map.
I’ve created an API key (http://joxi.ru/1A5x8nJsnnQ8j2) and inserted it into file “wp-admin/admin-footer.php” in order to display the map in the admin’s site, like that >
<script type=”text/javascript” src=”http://maps.google.com/maps/api/js?key=MYKEY”></script>
and JS code that is on this page https://www.advancedcustomfields.com/resources/google..
and now ill see the map. (http://joxi.ru/Dr8yqk9C44y0Mm).
Cause if don’t insert that code into this file, the map has doesn’t work like that > http://joxi.ru/L21zkaJh88LQvA
But now i have some errors into console > http://joxi.ru/GrqXRwBuQQ6WEA
And when I enter an address in a row, nothing happens.
BUT I also did all as specified in this manual https://www.advancedcustomfields.com/resources/google..
functions -> http://joxi.ru/n2Yaw10Ioon8q2
in footer.php – > http://joxi.ru/DmBL9GRFww8D9A
And now my question. What did I do wrong? And how to solve this problem and remove errors from the console? Please help me.
That’s because you added the API key twice, in functions.php and in the admin-footer.php. Kindly remove it from the admin-footer.php and see if it fixes the issue.
Thanks π
It did not help. I left only this code http://joxi.ru/Y2LYwWDs99gYXA in the functions.php file and now the map is not displayed http://joxi.ru/4AkoWYEtyyGL3A in the console such errors http://joxi.ru/Dr8yqk9C44E3Qm. I do not understand what I’m doing wrong. Please help me.
First, could you please remove the enqueue_scripts() function as it will duplicates the API?
Second, could you please let me know the ACF version you use? Please keep in mind that you need to use the acf/fields/google_map/api
hook if you use ACF free version and acf_update_setting() function if you use ACF PRO version. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/google-map/#google-map%20api.
Thanks π
I use the free version
And now in my file functions.php =>
function my_acf_google_map_api( $api ){
$api['key'] = 'AIzaSyCyzgGmDCh2sI0AZVs0u-...';
return $api;
}
add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
But in the console all the same errors %( http://joxi.ru/Dr8yqk9C44E3Qm
That’s weird. Could you please open a new ticket and provide temporary admin credentials to your site? You can open a new ticket here: https://support.advancedcustomfields.com/new-ticket. Also, please don’t forget to explain the issue again and provide the link to this thread.
Thanks π
Hello
I’m experiencing a very similar issue to Malv – searching for any address in the Map field suddenly stopped and disabling all the plugins does not solve it.
The loading icon just keeps turning…
I have a similar issue. The maps load on the backend and front end using the correct API key.
But I cannot search for an address.
It says “This page can’t load Google Maps correctly.”
Experienced the same here: maps displayed on both front and back ends but not in the backend: address suggestions was returning the same error message.
What solved it:
The project needed to include some extra API (geolocation and places I think) and had to be updated on Google’s console
You must be logged in to reply to this topic.
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!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and donβt forget to register for the next session! https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 9, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.