Support

Account

Home Forums Front-end Issues ACF front-end form Google Maps + Regular Maps Reply To: ACF front-end form Google Maps + Regular Maps

  • Hi @len

    For the page with a front end form, could you please remove the Google Maps script inclusion? Then, instead of this code:

    $(document).ready(function(){
    
        $('.acf-map').each(function(){
    
            // create map
            map = new_map( $(this) );
    
        });
    
    });

    Could you please use the following code instead?

    acf.add_action('load', function( $el ){
        
        $('.acf-map').each(function(){
    
            // create map
            map = new_map( $(this) );
    
        });
    
    });

    This code will make sure that ACF’s assets are loaded first, including the Google Maps script inclusion by ACF. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/.

    I hope this helps 🙂