How To Add Google Maps API Key To Your Site

Since June 22, 2016  Google requires the use of an API key. You can obtain this key for free by following the instructions over at: https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key

– Make sure the Google Maps API’s are enabled:

Google Maps Directions API
Google Maps Distance Matrix API
Google Maps Elevation API
Google Maps Geocoding API
Google Maps JavaScript API
Google Places API Web Service
Google Static Maps API

Once you have generated this API key go to Appearance > Theme Options > Map and paste it in "Google Maps API Key". 

Note: The Google Maps API Key theme option is only available since Realty v3.0. Make sure to update your theme, in case you are using a previous version of Realty.


To add your Google Maps API key in a version prior to Realty 3.0 open functions.php and search for "google-maps-api". It should be located around line 128 and looks like this:

wp_enqueue_script( 'google-maps-api', '//maps.googleapis.com/maps/api/js?sensor=false&libraries=places&v=3', array( 'jquery' ), null, false );

Change this line to and replace "YOUR_API_KEY" with your own key.

wp_enqueue_script( 'google-maps-api', '//maps.googleapis.com/maps/api/js?sensor=false&libraries=places&key=YOUR_API_KEY', array( 'jquery' ), null, false );


Note:   For property submit page, you will have to add API key to ACF Pro plugin also as they have not updated the plugin yet.

– Copy the generated API key


– Open the acf-input.min.js file located in the plugins folder of your WordPress-install (full path: /wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-input.min.js)

– find "sensor=false&libraries=places" and replace both instances with key=YOUR_API_KEY&libraries=places (replace YOUR_API_KEY with your own API key)


-- Make sure add key in all occurrences of "sensor=false&libraries=places" in this file .