Tagged: API, child theme, filter, google maps, script
-
AuthorPosts
-
August 21, 2014 at 4:41 pm #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,
- This topic was modified 10 years, 4 months ago by TinyGiantStudios.
August 22, 2014 at 8:18 am #307634Hey 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,
PeterAugust 25, 2014 at 10:21 am #308708Hi 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); }
August 25, 2014 at 2:57 pm #308839Hi,
great, glad you found a solution :)Cheers!
PeterAugust 5, 2015 at 10:41 am #483197i 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.August 5, 2015 at 11:18 am #483212 -
AuthorPosts
- The topic ‘Disable Google Maps API Call in Backend’ is closed to new replies.