php
Register Google Maps API Key for ACF
Register & define a Google Maps API key to allow the location field to work correctly.
Register & define a Google Maps API key to allow the location field to work correctly.
<?php
// Define this in the site's wp-config.php file.
define('GOOGLE_API_KEY', 'your-google-api-key-here');
// Add this to your functions.php file, or a config plugin/MU plugin.
add_filter( 'acf/fields/google_map/api', function ( $api ) {
$api['key'] = GOOGLE_API_KEY;
return $api;
} );