導讀:建站技術建站技術WP Rocket緩存插件會自動清除緩存,感覺用了這個緩存插件之后,到處是地雷和各種機關,稍不注意就可能把以前緩存的文章給刪了。這種效果對于那些八百年不更新舊文怎么搭建網站建站的技術。

WP Rocket緩存插件會自動清除緩存,感覺用了這個緩存插件之后,到處是地雷和各種機關,稍不注意就可能把以前緩存的文章給刪了。這種效果對于那些八百年不更新舊文章的人來說,簡直就是災難啊!幸好WP Rocket插件的官方給出了解決辦法,給出了一個叫 wp-rocket-no-cache-auto-purge?的插件,可以禁止WP Rocket自動刪除緩存。
插件的主要代碼如下所示:
<?php
/ **
?*?Plugin?Name:?WP?Rocket?|?Disable?Cache?Clearing
?*?Description:?Disables?all?of?WP?Rocket’s?automatic?cache?clearing.
?*?Plugin?URI:??https://github.com/wp-media/wp-rocket-helpers/tree/master/cache/wp-rocket-no-cache-auto-purge/
?*?Author:?WP?Rocket?Support?Team
?*?Copyright?SAS?WP?MEDIA?2018
?* /
namespace?WP_Rocket\Helpers\cache\no_cache_auto_purge;
//Standard?plugin?security,?keep?this?line?in?place.
defined(?'ABSPATH'?)?or?die();
/ **
?*?Remove?all?of?WP?Rocket’s?cache?purging?actions.
?*
?*?@author?Caspar?Hübinger
?* /
function?remove_purge_hooks()?{
????//WP?core?action?hooks?rocket_clean_domain()?gets?hooked?into.
????$clean_domain_hooks?=?array(
????????//When?user?changes?the?theme
????????'switch_theme',
????????//When?a?user?is?added
????????'user_register',
????????//When?a?user?is?updated
????????'profile_update',
????????//When?a?user?is?deleted
????????'deleted_user',
????????//When?a?custom?menu?is?updated
????????'wp_update_nav_menu',
????????//When?any?theme?modifications?are?updated
????????'update_option_theme_mods_'?.?get_option(?'stylesheet'?),
????????//When?you?change?the?order?of?widgets
????????'update_option_sidebars_widgets',
????????//When?category?permalink?prefix?is?update
????????'update_option_category_base',
????????//When?tag?permalink?prefix?is?update
????????'update_option_tag_base',
關鍵詞標簽: 建站 插件 緩存
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-23 ,文章如何禁止WP Rocket緩存插件自動清除緩存?,建站技主要講述緩存,插件,建站網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_34769.html