Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1146796

    We’re using a Google Maps field from Advanced Custom Fields to select a location when creating a new post (custom post type).
    The suggestions for an address don’t show up when using Enfold. We’re using an Enfold child theme, but the error persists when switching to Enfold. Works just fine when changing to twentynineteen theme.
    WP version is 5.2.3 and Enfold is 4.6.3.1

    Any ideas to what may cause this?

    #1147717

    Hey forde,

    Thank you for the inquiry.

    The theme’s map scripts are probably in conflict with the plugin’s. Where can we see the issue?

    You can disable the theme’s map element from the Enfold > Performance > Disable Template Builder Elements panel. Set the “Disabling of template builder elements” to the third option, then check the “Google Map Element” to disable it. Or use the “avf_load_google_map_api_prohibited” filter to prevent the map scripts from loading.

    Best regards,
    Ismael

    #1147798

    Thank you for your reply, unfortunately I had no success disabling the theme’s map element. I tried both methods you described.

    The problem is occuring in the back-end when we’re creating a new post with a custom post type.

    I used a command from ACF’s javascript library, ‘ acf.isset(google, ‘maps’, ‘places’, ‘Autocomplete’) ‘,
    which returned false when Enfold is activated – meaning Autocomplete is not activated. Same command returns true when twentynineteen is active). Somehow Enfold is turning off the autocomplete.

    No message about any javascript conflicts, if I manually enter the address and press the search button the marker is placed at the correct location (this is probably not the Autocomplete API though).
    All APIs are activated for this project in the Google Cloud Platform Console

    #1148099

    Hi,

    We are not really sure how you are using the scripts. Can you give us a link to the documentation? It would be wise to contact the plugin authors for additional help.

    Best regards,
    Ismael

    #1148467

    I too am having the exact same issue. It was working before but seems to have stopped.

    If I remove the api key from enfold settings, the backend ACF map does not load.

    I have tried both methods in my child’s functions.php from here: https://www.advancedcustomfields.com/resources/google-map/

    The map will not show at all if Enfold does not have it’s API field filled in.

    I tried switching to twenty nineteen, checked the edit post and I got the google maps cannot load message, then I added the exact same code I added to my enfold child functions.php to the functions.php in twenty nineteen, went back to post edit the map loads and suggestions come in.

    This means to me that enfold is ignoring the ACF inclusion completely and only counting it’s own.

    I have even tried the disabling the enfold maps as described here: https://kriesi.at/support/topic/disable-google-maps-api-call-in-backend/#post-308708

    But this does not work either, it still behaves the exact same way, even with this disable maps script, if I pop the API key into Enfolds settings, it loads a map but no autocomplete, I take it away, I get nothing. I have been running around in circles for 2 days on this now.

    I would really appreciate some help.

    #1149112

    Hi,

    Thank you for following up.

    Do you see any errors in the console when you’re on the ACF map interface or settings? It is possible that the map API is loaded twice. If that is the case, then you can use the following snippet to disable any map related scripts added by the theme.

    add_filter('avf_gmap_vars', 'avf_gmap_vars_disable', 10, 1); 
    function avf_gmap_vars_disable($map) {
    	$map = null;
    	return $map;
    }
    
    add_filter('avf_load_google_map_api_prohibited', 'avf_load_google_map_api_prohibited_true', 10, 1);
    function avf_load_google_map_api_prohibited_true($prohibited) {
    	if( is_admin() ) $prohibited = true;
    	return $prohibited;
    }
    
    add_action('init', 'ava_deregister_gmaps', 9999);
    function ava_deregister_gmaps() {
    	if(is_admin()) {
    		wp_deregister_script( 'avia-google-maps-api' );
    		wp_deregister_script( 'avia_google_maps_front_script' );
    		wp_deregister_script( 'avia_google_maps_api_script' );
    		wp_deregister_script( 'avia_google_maps_widget_admin_script' );
    	}
    }

    You can also try this filter.

    add_filter( 'avf_load_google_map_api', '__return_false' );
    

    Best regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.