ACF: How to set Google Maps API key

I am using Advanced Custom Fields for WordPress, and within that, I am trying to use the Google Maps field type.

After installation, there is no API key set for the usage of the Google Maps API, so you need to set it yourself. If you do not, you will get an error in the developer console of your browser:

Google Maps API error: MissingKeyMapError
Google Maps API warning: NoApiKeys


Here are the steps involved to save your API key for your Advanced Custom Fields Google Maps field type:

  1. Get an API key from Google
  2. Open your theme’s function.php and put the following code
    function my_acf_google_map_api( $api ){	
    	$api['key'] = 'YOUR_GOOGLE_MAPS_API_KEY';	
    	return $api;	
    add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
  3. Save the file,

It’s as simple as that. Enjoy.

Fixed: TypeError: Cannot read property ‘replace’ of undefined

So I tried to run my iOS Cordova hybrid app on the emulator with the following command

cordova run ios --emulator

What came back to me was a nasty error, which would not let me build the app on the emulator:

TypeError: Cannot read property 'replace' of undefined

I have found this solution on stackoverflow, which fixed it for me

cd platforms/ios/cordova/node_modules/
sudo npm install ios-sim@latest