• jojoma1

    (@jojoma1)


    Hello,

    I want to customize my Real Estate theme with ACF. My Google Maps API key works fine with the theme. I just plug the key into the settings. But when using the Google Maps field within ACF, I’m not sure how to make Google Maps work. I don’t see where to add the API key.

    Any ideas?

    Thanks a lot

Viewing 1 replies (of 1 total)
  • Jainil Nagar

    (@jainilnagar)

    Hello @jojoma1,

    You need to add the following code in your theme’s functions.php file which was mentioned in the documentation:

    
    // Method 1: Filter.
    function my_acf_google_map_api( $api ){
        $api['key'] = 'xxx';
        return $api;
    }
    add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
    
    // Method 2: Setting.
    function my_acf_init() {
        acf_update_setting('google_api_key', 'xxx');
    }
    add_action('acf/init', 'my_acf_init');
    
Viewing 1 replies (of 1 total)
  • The topic ‘Where to add Google Maps API?’ is closed to new replies.