In order for Google Map fields to render correctly when using ACF Pro you need a Google Maps API key. Use this filter to load the key for use by ACF Pro (assumes key has been set as a constant previously).
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( 'GOOGLE_MAPS_API_KEY', 'your_key_here' ); | |
add_action( 'acf/init', __NAMESPACE__ . '\set_google_maps_api_key' ); | |
/** | |
* Set Google Maps API key for use in ACF Pro backend. | |
* | |
* @since 1.0.0 | |
*/ | |
function set_google_maps_api_key() { | |
acf_update_setting( 'google_api_key', GOOGLE_MAPS_API_KEY ); | |
} |
Leave a Reply