Home › Forums › Backend Issues (wp-admin) › Google maps – MissingKeyMapError
Hi,
Today I installed WordPress 4.5.3 and the newest ACF plugin. I added google map field to my custom post type. When I add/edit new post I got this error:
Oops! Something went wrong.
This page didn’t load Google Maps correctly. See the JavaScript console for technical details.
In console we can see this:
Google Maps API error: MissingKeyMapError
How to solve that problem?
I’m not native English man so sorry for my grammar if it’s wrong 🙂
Regards,
The Google Maps APIs require an API key for new domains as of today. See announcement: http://googlegeodevelopers.blogspot.com.au/2016/06/building-for-scale-updates-to-google.html
For developers: I think Google Maps API key should be added to ACF settings and used calling Google Maps API.
Bajaczysko, my answer is not a solution of a problem, please keep issue unsolved – so developer can see this issue and fix it in next update.
killexx, yeah you are right but I can’t remove “solved” from your post. Anyway I created ticket with this problem too and I got respond that team will be inform with this bug 🙂 In the next update problem will be solved.
A temporary solution was posted in this topic https://support.advancedcustomfields.com/forums/topic/google-maps-field-needs-setting-to-add-api-key/#post-40161
There is a fix for this in the new version of ACF Pro. You can get it by logging into your account and downloading from there. It is 5.4.0-beta3.
Just tried the beta and still getting the same error.
I see that this issue is also tagged as “solved” so I wonder if I am missing something.
I just downloaded the Beta and that still doesn’t work.
Edit – You’ll need to add a filter to get the key in:
add_filter('acf/settings/google_api_key', function () {
return 'your-api-key';
});
Credit goes to aaemnnosttv
For those like me who are late to the party, ACF posted a solution. This worked for me on version 4.4.11 of the free plugin.
Drop this in your functions.php file and replace ‘xxx’ with your API key:
function my_acf_google_map_api( $api ){
$api['key'] = 'xxx';
return $api;
}
add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
https://www.advancedcustomfields.com/resources/acf-fields-google_map-api/
Using WordPress 4.7.2, ACF 4.4.11 and ACF: Location Field 1.0.0, the acf/fields/google_map/api filter did not work for me. What did work was to directly edit acf-location-field-master/location-v3.php and acf-location-field-master/location-v4.php to alter function admin_head() and function input_admin_head() to specify the API key:
echo '<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=[your key]"></script>';
To fix front end, I added same script link to header.php.
It might not be obvious, needing to add your field key is noted in the google map field documentation https://www.advancedcustomfields.com/resources/google-map/. It’s in the 3rd code example, the one under Helpers at about line 16.
This code could be added to header using an filter on wp_head or put directly into your header.php file.
Hi all,
I solved this with this plugin :
https://wordpress.org/plugins/api-key-for-google-maps/
Hope it helps.
Stéphane
The topic ‘Google maps – MissingKeyMapError’ is closed to new replies.
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.