Tagged: google maps
Hi,
Although the Google Map is only displayed on the contact page, the Google Maps scripts are loaded on every page.
How can I prevent this from happening?
Regards,
Jan
Hey Jan,
this is the default setting. If you deactivate it things won’t work well anymore. However, yo could hire a freelance developer for this job, if you really need it.
Best regards,
Andy
Hi Andy,
Thanks for you feedback on this.
Best regards,
Jan
well there are a lot of code snippets here on board to deactivate google maps.
maybe something like this is working. (you can see that accept page 3184 the maps api isn’t loaded)
this comes to child-theme functions.php:
add_filter('avf_load_google_map_api', 'disable_google_map_api', 10, 1);
function disable_google_map_api($load_google_map_api) {
if( !is_page(3184) ) {
$load_google_map_api = false;
return $load_google_map_api;
}
}
But ! if you have the maps in the widget area you have to see how you can manage it.
And if you use some caching tools – i don’t know how if this will work too
On a test installation of mine it seems to work Link
Hi Guenni007,
Thank you for providing the code snippet, I will check if it is working for me.
Regards,
Jan