Home › Forums › ACF PRO › Google maps API included multiple times › Reply To: Google maps API included multiple times
Hi @mcgwd
You should be able to do it with the load
action like this:
function autocomplete_map_init() {
?>
<script type="text/javascript">
(function($){
$(document).ready(function(){
// Do it after all of the assets are loaded
acf.add_action('load', function( $el ){
// Only execute the init function if there's a google
// map on the page
if( acf.fields.google_map.map ){
// execute the init function
initAutocomplete();
}
});
});
})(jQuery);
</script>
<?php
}
add_action('acf/input/admin_footer', 'autocomplete_map_init');
I hope this helps 🙂
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.