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

How to disable google maps in wordpress

尚
Original
2019-07-12 13:49:29 4223browse

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); }

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' );

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 thewordpress tutorialcolumn 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!

Statement:
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