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

    Hi Kriesi & Co,

    I followed the advice on this thread: https://kriesi.at/support/topic/google-maps-api-multiple-times-on-the-page/

    Unfortunately the filter provided for a child theme doesn’t work at all; Is there any other way to remove the Google Maps API call?
    For reference, the filter provided is:

    add_filter('avia-google-maps-api', '__return_false', 10, 2);

    Kind Regards,

    #307634

    Hey TinyGiantStudios!

    Can you please post a link to the page which loads the google api multiple times? I need to check which plugins and theme components load the api to answer the question if the filter will work for you.

    Best regards,
    Peter

    #308708

    Hi Peter,

    Thanks for getting back to me. The plugin that loads the additional maps API is a custom written one that integrates with another 3rd party plugin. Suffice to say, I managed to deactivate that of Enfold by using the following code:

    	/*
    	 *  Remove Google Maps API Call if used in Enfold theme and Auto Location is active
    	 */
    	function disable_google_map_api($load_google_map_api) {
    		$load_google_map_api = false;
    		return	$load_google_map_api;
    	}
    
    	$plugins = get_option('active_plugins');
    	$required_plugin = 'auto-location-pro/auto-location.php';
    	
    	if ( in_array( $required_plugin , $plugins ) ) {
    		add_filter('avf_load_google_map_api', 'disable_google_map_api', 10, 1);
    	}
    #308839

    Hi,
    great, glad you found a solution :)

    Cheers!
    Peter

    #483197

    i had that problem too. i use enfold theme with a child theme so i can have changes on some template files.
    i then use ACF to load a google maps field in post-edit. But for some reason the map did not appear as long as i use enfold theme. there is no JS error in console. but i found out, that you just need a very simple filter to make it work:
    add_filter( 'avf_load_google_map_api', '__return_false' );
    put that in your child theme functions.php and google maps will work.

    #483212

    Hi!


    @sonyseven
    Glad you figured it out and thanks for sharing your solution :)

    Regards,
    Yigit

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Disable Google Maps API Call in Backend’ is closed to new replies.