18 Jul

Google Maps API settings

Google have introduced new changes to their API requests and you may need to register an API key

By Elliot Condon

Google have introduced new changes to their API requests as of June 22nd, 2016. These changes restrict the number of website’s allowed to use their free map API services.

You will find a short statement from Google listing the changes here: http://googlegeodevelopers.blogspot.com.au/2016/06/building-for-scale-updates-to-google.html

What does this mean for me?

This means you may need to register a google API key in order to load a Google Map field both on the back-end (when editing a post) and on the front-end (when rendering a map).

Updates will be made to both ACF (v4) and ACF PRO (v5) allowing a Google API key to be registered.

It may be necessary to register a Google API key in order to allow the Google API to load correctly. Please follow this link to get a Google API key.

How to register an API key

The Google Map field documentation has been updated to include the following instructions.

It may be necessary to register a Google API key in order to allow the Google API to load correctly. Please follow this link to get a Google API key.

To register your Google API key, please use the ‘acf/fields/google_map/api’ filter like so:

functions.php

function my_acf_google_map_api( $api ){
    
    $api['key'] = 'xxx';
    
    return $api;
    
}

add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');

If using ACF PRO, you may find it easier to update the ‘google_api_key’ setting instead:

functions.php

function my_acf_init() {
    
    acf_update_setting('google_api_key', 'xxx');
}

add_action('acf/init', 'my_acf_init');

Thank you

Thank you for your support and patience whilst I address these new changes and find solutions.

About the Author