wordpress如何禁用谷歌地圖

wordpress如何禁用谷歌地圖

許多主題和插件都將google maps api與它捆綁在一起,這可能會破壞您的性能優化工作。雖然google maps api是在異步中加載的,但它確實會大幅增加頁面的總加載時間。

/* *??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); }

將代碼寫入functions.php保存即可。

使用下方的代碼將禁用整站的谷歌地圖。

add_filter(?'avf_load_google_map_api',?'__return_false'?);

寫入functions.php保存即可。使用此代碼會禁用整站的谷歌地圖,嵌入的包含地圖的網頁也會禁止。

更多WordPress相關技術文章,請訪問wordpress教程欄目進行學習!

? 版權聲明
THE END
喜歡就支持一下吧
點贊13 分享