[WordPress] 外掛分享: Disable CSS JS Cache

首頁外掛目錄 › Disable CSS JS Cache
WordPress 外掛 Disable CSS JS Cache 的封面圖片
400+
安裝啟用
★★★★★
5/5 分(2 則評價)
9 天前
最後更新
問題解決
WordPress 5.5+ PHP 7.4+ v1.2.0 上架:2023-05-06

內容簡介

以下為總結:

WordPress 內建快取機制,可有效減少網頁載入時間,提升網站效能,但有時也會導致過時的 CSS 或 JS 檔案被載入,導致網站顯示問題。此外掛提供解決辦法,提供載入已更新的 css 和 js 的選項。

以下為問題與答案:<br>

問題:WordPress 內建的快取機制有什麼好處?<br>
答案:WordPress 內建快取機制可有效減少網頁載入時間,提升網站效能。

問題:WordPress 內建的快取機制可能導致什麼問題?<br>
答案:快取機制有時也會導致過時的 CSS 或 JS 檔案被載入,導致網站顯示問題。

問題:此外掛提供什麼解決辦法?<br>
答案:此外掛提供選項,讓你可以載入已更新的 CSS 和 JS。

問題:此外掛有哪些核心功能?<br>
答案:此插件提供選項來啟用或停用 CSS 和 JS 快取。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.2.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Disable CSS JS Cache」→ 直接安裝(推薦)

原文外掛簡介

Disable CSS JS Cache is a lightweight plugin that helps WordPress developers and site administrators control browser caching for CSS and JavaScript files. Ideal for development, testing, or any time you need browsers to always load the freshest files.
Key Features

Cache Busting — Appends a dynamic version parameter to CSS/JS URLs so browsers skip the cache
Two Busting Methods — Force Refresh (timestamp, every page load) or Smart Refresh (file modification time, only when the file actually changes)
File-Type Control — Apply cache busting to both CSS & JS, CSS only, or JS only
Strip Existing Version — Remove WordPress’s built-in ?ver= before adding ours, preventing duplicate parameters
Per-Page Override — Disable cache busting on individual pages or posts via a meta box in the editor (new in 1.2.0)
CDN Support — Optionally apply cache busting to external/CDN-hosted files
Exclude Paths — Skip specific files or URL fragments
Browser Caching (.htaccess) — Add long-lived Cache-Control headers for images, CSS, JS, and PDF files
Configurable Cache Duration — 60 seconds up to 1 year
Admin Bar Quick Toggle — One-click enable/disable from the toolbar
Statistics Dashboard — See how many CSS and JS files have been processed
Clear Cache Button — Flush WordPress object cache and compatible caching plugins in one click
Admin Notice — Optional reminder when cache busting is active (handy for production sites)
Clean Uninstall — Removes all settings and .htaccess rules when the plugin is deleted

How It Works
When cache busting is enabled, the plugin adds a ?ver= query string to every CSS and JS URL loaded on the frontend. Browsers treat each new URL as a fresh request, ignoring any cached copy. Choose Force Refresh for development (version changes every page load) or Smart Refresh for production (version changes only when the file timestamp changes).
The optional .htaccess browser-caching feature writes Cache-Control headers so returning visitors load static assets straight from their browser cache.
Use Cases

Development — See theme/plugin changes instantly without clearing your browser cache
Staging — Verify the latest files are loaded during QA
Production — Enable browser caching for performance while still being able to bust the cache on demand
Troubleshooting — Quickly rule out stale-cache issues

Technical Details
Developer Hooks
Action
do_action( ‘disable_css_js_cache_cleared’ ) — fires when the Clear Cache button is clicked.
Filters (WordPress core, used by this plugin)
style_loader_src, script_loader_src
Constants
DISABLE_CSS_JS_CACHE_VERSION — current plugin version string
DISABLE_CSS_JS_CACHE_FILE — absolute path to the main plugin file
DISABLE_CSS_JS_CACHE_DIR — absolute path to the plugin directory (with trailing slash)

Requirements

* WordPress 5.5 or higher
* PHP 7.4 or higher
* Apache with mod_headers (browser-caching feature only)
* Writable .htaccess (browser-caching feature only)

延伸相關外掛

文章
Filter
Mastodon