Home › Forums › Front-end Issues › Google Maps Field Frontend Issue › Reply To: Google Maps Field Frontend Issue
Please keep in mind that you only need to add the Google Maps script once. So it should be something like this:
function my_theme_add_scripts() {
wp_enqueue_script( 'google-map', 'https://maps.googleapis.com/maps/api/js?key=KEYGOESHERE', array(), '3', true );
wp_enqueue_script( 'google-map-init', get_template_directory_uri() . '/js/google-maps.js', array('google-map', 'jquery'), '0.1', true );
}
add_action( 'wp_enqueue_scripts', 'my_theme_add_scripts' );
Please don’t forget to replace the “KEYGOESHERE” text with your Google Maps API key.
If the issue persists, could you please check the console tab of your developer tools for any JavaScript error messages on the page?
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.