Home › Forums › Front-end Issues › Enqueue Google Map › Reply To: Enqueue Google Map
Hi @rudtek
Thanks for the reply. Can’t believe I missed the typo.
Ok, I’ve amended the typo and tried with true (several ways) but still no joy:
function prefix_enqueue_scripts() {
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?key=KEY' );
#wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?key=KEY', true );
#wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?key=KEY', '', true );
wp_enqueue_script( 'google-map-init', get_template_directory_uri() . '/js/acf-map.js', array('jquery', 'google-maps'), '', true);
}
add_action( 'wp_enqueue_scripts', 'prefix_enqueue_scripts' );
Checking the console logs, it shows:
Google Maps JavaScript API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
If I check the source code, I can see the script is called but seems to get truncated:
<script type='text/javascript' src='https://maps.googleapis.com/maps/api/js'></script>
It’ missing the API key or is that correct?
Thanks
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.