Home > CMS Tutorial > WordPress > How to disable google maps in wordpress

How to disable google maps in wordpress

Release: 2019-07-12 13:49:29
Original
4400 people have browsed it

How to disable google maps in wordpress

Many themes and plugins bundle the Google Maps API with it, which can disrupt your performance optimization efforts. Although the Google Maps API loads asynchronously, it does significantly increase the overall load time of the page.

/*
*  Remove Google Maps API Call
*/
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);
}
Copy after login

Write the code into functions.php and save it.

Using the code below will disable Google Maps for the entire site.

add_filter( 'avf_load_google_map_api', '__return_false' );
Copy after login

Write it into functions.php and save it. Using this code will disable Google Maps for the entire site, as well as embedded pages containing maps.

For more wordpress related technical articles, please visit the wordpress tutorial column to learn!

The above is the detailed content of How to disable google maps in wordpress. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template