[WordPress] 外掛分享: Clear Cache for Me

前言介紹

  • 這款 WordPress 外掛「Clear Cache for Me」是 2014-01-23 上架。
  • 目前有 40000 個安裝啟用數。
  • 上一次更新是 2025-03-31,距離現在已有 34 天。
  • 外掛最低要求 WordPress 3.8 以上版本才可以安裝。
  • 有 29 人給過評分。
  • 論壇上目前有 3 個提問,問題解答率 100% ,不低,算是個很有心解決問題的開發者團隊了!

外掛協作開發者

webheadllc |

外掛標籤

JS | css | cache | clear | Purge |

內容簡介

Clear Cache For Me 是一個 WordPress 外掛,適用於 W3 Total Cache 和 WP Super Cache,因為它們不知道 widget 何時更新,且在更新 widget 和 menu 時都不會更新快取系統。此外,WPEngine 是 WordPress 安裝的最佳地點,但其快取系統在更新 widget 和 menu 時也不會更聰明。作者因為自己的網站在使用這些快取系統時沒有觀察到任何變化,因此創建了此外掛。每次儲存時,Clear Cache For Me 會清除所有快取,而不需要額外按下按鈕,雖然可能有點多餘,但有些人需要簡單易用的功能。

除了清除快取系統外,Clear Cache For Me 還可以強制瀏覽器重新加載現有主題的 CSS 和 JS 檔案。有時我們有修改主題的 CSS 和 JS 檔案,但瀏覽器仍舊無法獲得最新版本,因此在儀表板上按下“立即清除快取”按鈕後,瀏覽器會被強制重新加載現有主題的 CSS 和 JS 檔案。如果不按下“立即清除快取”按鈕,瀏覽器將像往常一樣緩存 CSS 和 JS 檔案。

在以下快取系統上運作:

Autoptimize
Breeze Cache
Cache Enabler
GoDaddy Cache
Kinsta Cache
LiteSpeed Cache
SiteGround SuperCacher
WP Fastest Cache
WP Super Cache
WP Optimize Cache
W3 Total Cache
WPEngine Cache

當以下操作發生時,此外掛會清除所有快取(需要上述任何快取系統活動):

儲存 Widget 時
儲存 Customizer 時
儲存 Menu 時
儲存進階自訂欄位中的欄位時
儲存 Contact Form 7 表單時
儲存 Formidable Form 表單時
儲存 WooThemes 設定時
更新 NextGen Gallery 相簿和圖庫時(測試版-可能不會清除所有快取)
儲存 Qode 選項時,此外掛會強制瀏覽器重新加載自訂的 CSS 和 JS
儲存 WP Forms 表單或設定時
儲存 WooCommerce 設定時(當產品儲存時應已清除快取)
儲存由 WPBeginner 的 Insert Headers and Footers 外掛的設定時。
儲存設定頁面的設定時。包括 WordPress 核心,Yoast SEO 和大多數使用設定 API 的其他外掛
WordPress 更新時
更新、啟用和停用插件時

有開發者選項可供選擇:

開發者選項

ccfm_supported_caching_exists

使用此篩選器來判斷此外掛是否應執行任何操作,包括在儀表板上顯示按鈕。如果支持快取系統,請返回 true。
默認: 如果任何受支持的快取系統正在運行,則為 True。
請參閱下面的示例 1。

ccfm_admin_init 或 ccfm_init_actions

在清除快取時使用此操作來添加鉤子。或進行任何其他設置活動。

ccfm_clear_cache_for_me_before

使用此操作從不支援的快取系統清除快取,然後再清除快取。

原文外掛簡介

W3 Total Cache and WP Super Cache are great caching plugins, but they do not know when a widget is updated. WPEngine is the best place to host your WordPress installation, but their caching system is no smarter when it comes to updating widgets and menus. I created this plugin because my website did not see any changes when saving widgets or menus using these caching systems. Clear Cache For Me will purge ALL your cache each time you do a save without having to press an additional button. It may be overkill, which may be why it’s not built in, but some people need simplicity.
In addition to clearing those pesky caching engines, Clear Cache for Me can force your browser to reload your current theme’s CSS and JS files. I modify my theme’s CSS and JS files every so often and always have trouble with the browser not getting the latest version. So now after clicking on the “Clear Cache Now!” button on the dashboard the browser will be forced to reload the current theme’s CSS and JS files. If you do not click the “Clear Cache Now!” button, the browser will cache the CSS and JS files like it normally does.
The popular Qode themes has a options to set your own custom CSS and JS. Sometimes you may not see your changes for a long while because your browser is trying to get the cached file. Whenever you save your Qode’s options, the CSS and JS files will be forced to reload in the browser on the public side.
Works with the following caching plugins:

Autoptimize
Breeze Cache
Cache Enabler
GoDaddy Cache
Kinsta Cache
LiteSpeed Cache
Elementor (CSS cache)
Premium Addons for Elementor
SiteGround SuperCacher
Super Page Cache
WP Fastest Cache
WP Optimize Cache
WP Rocket
WP Super Cache
W3 Total Cache
WPEngine Cache

Clears all cache for following actions (requires a caching system above to be active):

When Widgets are saved.
When Customizer is saved.
When Menus are saved.
When a fields in Advanced Custom Fields are saved.
When a Contact Form 7 form is saved.
When a Formidable Form form is saved.
When WooThemes settings are saved.
When NextGen Gallery albums and galleries are updated (beta – may not clear cache on all actions).
When Qode options are saved this plugin forces browsers to reload the custom css and custom js.
When a WP Forms forms or settings are saved.
When WooCommerce settings are saved. (Cache should already be clearing when products are saved.)
When settings from the Insert Headers and Footers plugin by WPBeginner are saved.
When Settings from a settings page is saved. This includes settings from WordPress core, Yoast SEO, and most other plugins using the Settings API.
When WordPress is updated.
When plugins are updated, activated, and deactivated.
When WordPress, plugins, and themes are automaticallly updated.

See the plugin’s homepage for more details.
Note: Since some caching systems run in the shutdown hook, this plugin also runs in that hook. This means if PHP does not have enough time, some code including any hooks within the ccfm_clear_cache_for_all() function are not guaranteed to run. If you need code to run, consider using the ccfm_clear_cache_for_me_setup hook.
Developer Options
ccfm_supported_caching_exists
Use this filter to determine if this plugin should do anything including showing the button on the dashboard. Return true if a caching system is supported.
Default: True if any of the supported caching systems is active.
See Example 1 below.
ccfm_admin_init or ccfm_init_actions
Use this action to add hooks when cache is to be cleared. Or do any other setup activity.
ccfm_clear_cache_for_me_before
Use this action to clear cache from an unsupported caching system before the default caching systems clear their cache.
ccfm_clear_cache_for_me
Use this action to clear cache from an unsupported caching system after the default caching systems clear their cache.
Example
If you were using an unsupported caching system you’ll need to identify the caching plugin’s class or function which clears the cache. As an example, if the unsupported caching system called the MyOtherCache::clear_all() function, you would use the following code to get this plugin to clear the cache.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Clear Cache for Me」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1.0 | 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7 | 1.8 | 2.0 | 2.1 | 2.2 | 2.3 | 2.4 | 0.91 | 0.92 | 0.93 | 0.6.1 | 0.6.2 | 0.7.1 | 1.1.1 | 1.4.1 | 1.5.1 | 2.0.1 | 2.1.1 | 2.4.1 | trunk |

延伸相關外掛(你可能也想知道)

文章
Filter
Apply Filters
Mastodon