Forked from mishterk/define-google-maps-api-key-for-acf.php
Created
June 3, 2022 20:32
-
-
Save schutzsmith/ba0383b196fdecdeecdaf006d2eb40ca to your computer and use it in GitHub Desktop.
Register Google Maps API Key for ACF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment