{"id":174036,"date":"2023-05-07T14:46:37","date_gmt":"2023-05-07T14:46:37","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/disable-css-js-cache\/"},"modified":"2026-09-05T15:15:37","modified_gmt":"2026-09-05T15:15:37","slug":"disable-css-js-cache","status":"publish","type":"plugin","link":"https:\/\/ca.wordpress.org\/plugins\/disable-css-js-cache\/","author":20951130,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.2.0","stable_tag":"trunk","tested":"7.1","requires":"5.5","requires_php":"7.4","requires_plugins":null,"header_name":"Disable CSS JS Cache","header_author":"Umang Prajapati","header_description":"This plugin helps prevent browser caching of CSS and JS files from theme in WordPress.","assets_banners_color":"adcdc4","last_updated":"2026-09-05 15:15:37","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/phptutorialpoints.in","header_author_uri":"https:\/\/phptutorialpoints.in","rating":5,"author_block_rating":0,"active_installs":400,"downloads":5552,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":{"1.2.0":"<p>New per-page override and strip-existing-version features. PHP minimum raised to 7.4. Fully backward compatible \u2014 no settings migration needed.<\/p>","1.1.0":"<p>Major feature update: admin bar toggle, statistics, performance modes, CDN support, cache-clear button.<\/p>","1.0.9":"<p>Security and stability release. Fixes deactivate link and fatal errors.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":2},"assets_icons":{"icon.svg":{"filename":"icon.svg","revision":2967907,"resolution":false,"location":"assets","locale":false}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":3579831,"resolution":"1544x500","location":"assets","locale":"","width":1544,"height":500},"banner-772x250.png":{"filename":"banner-772x250.png","revision":3579825,"resolution":"772x250","location":"assets","locale":"","width":772,"height":250}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":2909093,"resolution":"1","location":"assets","locale":"","width":1920,"height":892}},"screenshots":{"1":"Plugin settings page"}},"plugin_section":[],"plugin_tags":[5757,146,356,229,247],"plugin_category":[52,54,59],"plugin_contributors":[267070],"plugin_business_model":[],"class_list":["post-174036","plugin","type-plugin","status-publish","hentry","plugin_tags-browser-cache","plugin_tags-cache","plugin_tags-css","plugin_tags-javascript","plugin_tags-performance","plugin_category-performance","plugin_category-security-and-spam-protection","plugin_category-utilities-and-tools","plugin_contributors-umangprajapati","plugin_committers-umangapps48"],"banners":{"banner":"https:\/\/ps.w.org\/disable-css-js-cache\/assets\/banner-772x250.png?rev=3579825","banner_2x":"https:\/\/ps.w.org\/disable-css-js-cache\/assets\/banner-1544x500.png?rev=3579831","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":"https:\/\/ps.w.org\/disable-css-js-cache\/assets\/icon.svg?rev=2967907","icon":"https:\/\/ps.w.org\/disable-css-js-cache\/assets\/icon.svg?rev=2967907","icon_2x":false,"generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/disable-css-js-cache\/assets\/screenshot-1.png?rev=2909093","caption":"Plugin settings page"}],"raw_content":"<!--section=description-->\n<p>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.<\/p>\n\n<h3>Key Features<\/h3>\n\n<ul>\n<li><strong>Cache Busting<\/strong> \u2014 Appends a dynamic version parameter to CSS\/JS URLs so browsers skip the cache<\/li>\n<li><strong>Two Busting Methods<\/strong> \u2014 Force Refresh (timestamp, every page load) or Smart Refresh (file modification time, only when the file actually changes)<\/li>\n<li><strong>File-Type Control<\/strong> \u2014 Apply cache busting to both CSS &amp; JS, CSS only, or JS only<\/li>\n<li><strong>Strip Existing Version<\/strong> \u2014 Remove WordPress's built-in <code>?ver=<\/code> before adding ours, preventing duplicate parameters<\/li>\n<li><strong>Per-Page Override<\/strong> \u2014 Disable cache busting on individual pages or posts via a meta box in the editor (new in 1.2.0)<\/li>\n<li><strong>CDN Support<\/strong> \u2014 Optionally apply cache busting to external\/CDN-hosted files<\/li>\n<li><strong>Exclude Paths<\/strong> \u2014 Skip specific files or URL fragments<\/li>\n<li><strong>Browser Caching (.htaccess)<\/strong> \u2014 Add long-lived <code>Cache-Control<\/code> headers for images, CSS, JS, and PDF files<\/li>\n<li><strong>Configurable Cache Duration<\/strong> \u2014 60 seconds up to 1 year<\/li>\n<li><strong>Admin Bar Quick Toggle<\/strong> \u2014 One-click enable\/disable from the toolbar<\/li>\n<li><strong>Statistics Dashboard<\/strong> \u2014 See how many CSS and JS files have been processed<\/li>\n<li><strong>Clear Cache Button<\/strong> \u2014 Flush WordPress object cache and compatible caching plugins in one click<\/li>\n<li><strong>Admin Notice<\/strong> \u2014 Optional reminder when cache busting is active (handy for production sites)<\/li>\n<li><strong>Clean Uninstall<\/strong> \u2014 Removes all settings and .htaccess rules when the plugin is deleted<\/li>\n<\/ul>\n\n<h3>How It Works<\/h3>\n\n<p>When cache busting is enabled, the plugin adds a <code>?ver=<\/code> 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 <strong>Force Refresh<\/strong> for development (version changes every page load) or <strong>Smart Refresh<\/strong> for production (version changes only when the file timestamp changes).<\/p>\n\n<p>The optional <code>.htaccess<\/code> browser-caching feature writes <code>Cache-Control<\/code> headers so returning visitors load static assets straight from their browser cache.<\/p>\n\n<h3>Use Cases<\/h3>\n\n<ul>\n<li><strong>Development<\/strong> \u2014 See theme\/plugin changes instantly without clearing your browser cache<\/li>\n<li><strong>Staging<\/strong> \u2014 Verify the latest files are loaded during QA<\/li>\n<li><strong>Production<\/strong> \u2014 Enable browser caching for performance while still being able to bust the cache on demand<\/li>\n<li><strong>Troubleshooting<\/strong> \u2014 Quickly rule out stale-cache issues<\/li>\n<\/ul>\n\n<h3>Technical Details<\/h3>\n\n<h3>Developer Hooks<\/h3>\n\n<p><strong>Action<\/strong>\n    do_action( 'disable_css_js_cache_cleared' ) \u2014 fires when the Clear Cache button is clicked.<\/p>\n\n<p><strong>Filters (WordPress core, used by this plugin)<\/strong>\n    style_loader_src, <code>script_loader_src<\/code><\/p>\n\n<h3>Constants<\/h3>\n\n<pre><code>DISABLE_CSS_JS_CACHE_VERSION \u2014 current plugin version string\nDISABLE_CSS_JS_CACHE_FILE    \u2014 absolute path to the main plugin file\nDISABLE_CSS_JS_CACHE_DIR     \u2014 absolute path to the plugin directory (with trailing slash)&lt;h3&gt;Requirements&lt;\/h3&gt;\n<\/code><\/pre>\n\n<p>* WordPress 5.5 or higher\n* PHP 7.4 or higher\n* Apache with <code>mod_headers<\/code> (browser-caching feature only)\n* Writable <code>.htaccess<\/code> (browser-caching feature only)<\/p>\n\n<!--section=installation-->\n<p><strong>Automatic<\/strong><\/p>\n\n<ol>\n<li>Go to Plugins &gt; Add New in your WordPress admin<\/li>\n<li>Search for <em>Disable CSS JS Cache<\/em><\/li>\n<li>Click Install Now, then Activate<\/li>\n<\/ol>\n\n<p><strong>Manual<\/strong><\/p>\n\n<ol>\n<li>Download the plugin ZIP<\/li>\n<li>Go to Plugins &gt; Add New &gt; Upload Plugin<\/li>\n<li>Upload the ZIP and activate<\/li>\n<\/ol>\n\n<p><strong>Configuration<\/strong><\/p>\n\n<ol>\n<li>Go to Settings &gt; Disable CSS JS Cache<\/li>\n<li>Enable Cache Busting and choose a method<\/li>\n<li>Optionally configure Browser Caching for production performance<\/li>\n<li>Click Save Settings<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id=\"will%20this%20slow%20down%20my%20site%3F\"><h3>Will this slow down my site?<\/h3><\/dt>\n<dd><p>No. The plugin hooks into WordPress's existing script\/style loader with minimal overhead. When Smart Refresh is used, the overhead is limited to a single <code>filemtime()<\/code> call per file, only on the frontend.<\/p><\/dd>\n<dt id=\"does%20this%20work%20with%20page%20caching%20plugins%3F\"><h3>Does this work with page caching plugins?<\/h3><\/dt>\n<dd><p>Yes. This plugin modifies file URLs, not page output, so it works alongside WP Super Cache, W3 Total Cache, WP Rocket, LiteSpeed Cache, and similar plugins.<\/p><\/dd>\n<dt id=\"what%20is%20%22strip%20existing%20version%22%3F\"><h3>What is \"Strip Existing Version\"?<\/h3><\/dt>\n<dd><p>WordPress adds its own <code>?ver=X.X<\/code> to enqueued files. With Force Refresh enabled, that becomes <code>?ver=6.7&amp;ver=1234567890<\/code>. Enabling Strip Existing Version removes WordPress's parameter first, leaving only ours.<\/p><\/dd>\n<dt id=\"what%20is%20the%20per-page%20override%3F\"><h3>What is the Per-Page Override?<\/h3><\/dt>\n<dd><p>When enabled, a \"Cache Busting\" meta box appears on every public post\/page in the block editor and classic editor. Checking the box disables cache busting for that specific page \u2014 useful for pages where you want the browser to cache assets normally.<\/p><\/dd>\n<dt id=\"will%20this%20affect%20admin-area%20scripts%3F\"><h3>Will this affect admin-area scripts?<\/h3><\/dt>\n<dd><p>No. Cache busting only runs on the frontend.<\/p><\/dd>\n<dt id=\"what%20happens%20to%20my%20.htaccess%20when%20i%20deactivate%20the%20plugin%3F\"><h3>What happens to my .htaccess when I deactivate the plugin?<\/h3><\/dt>\n<dd><p>All browser-caching rules written by this plugin are automatically removed from <code>.htaccess<\/code> on deactivation.<\/p><\/dd>\n<dt id=\"does%20this%20work%20on%20nginx%3F\"><h3>Does this work on Nginx?<\/h3><\/dt>\n<dd><p>The <code>.htaccess<\/code> browser-caching feature requires Apache with <code>mod_headers<\/code>. The cache-busting feature (URL versioning) works on any server.<\/p><\/dd>\n<dt id=\"is%20this%20multisite%20compatible%3F\"><h3>Is this multisite compatible?<\/h3><\/dt>\n<dd><p>Yes. The uninstall routine cleans up options for every site in the network.<\/p><\/dd>\n<dt id=\"does%20this%20work%20with%20cdn%3F\"><h3>Does this work with CDN?<\/h3><\/dt>\n<dd><p>The cache-busting feature works with CDN-hosted files when the CDN \/ External Files option is enabled. Note that some CDNs strip query parameters \u2014 test before enabling in production.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.2.0<\/h4>\n\n<ul>\n<li><strong>New<\/strong>: Per-Page Override \u2014 disable cache busting on individual posts\/pages via an editor meta box<\/li>\n<li><strong>New<\/strong>: Strip Existing Version option \u2014 removes WordPress's built-in <code>?ver=<\/code> before adding ours, preventing duplicate parameters<\/li>\n<li><strong>New<\/strong>: PHP 8.0+ union-type return types and <code>mixed<\/code> parameter types throughout<\/li>\n<li><strong>New<\/strong>: Defined <code>DISABLE_CSS_JS_CACHE_FILE<\/code> and <code>DISABLE_CSS_JS_CACHE_DIR<\/code> constants for easier path handling<\/li>\n<li><strong>New<\/strong>: <code>dcjc_safe_include()<\/code> helper replaces inline path-traversal checks in the bootstrap file<\/li>\n<li><strong>Improved<\/strong>: Replaced <code>str_contains<\/code> \/ <code>str_starts_with<\/code> calls (PHP 8 builtins, safe on PHP 7.4+)<\/li>\n<li><strong>Improved<\/strong>: <code>.htaccess<\/code> rules now use <code>sprintf<\/code> for cleaner, auditable output<\/li>\n<li><strong>Improved<\/strong>: Settings registration refactored \u2014 checkboxes registered in a loop to reduce repetition<\/li>\n<li><strong>Improved<\/strong>: Sanitize callbacks tightened with explicit allowed-value lists for radio\/select fields<\/li>\n<li><strong>Improved<\/strong>: Admin bar handler correctly defaults <code>_wpnonce<\/code> with null-coalescing operator<\/li>\n<li><strong>Updated<\/strong>: Requires PHP 7.4 (was 7.0) \u2014 aligns with WordPress's own minimum for 6.x\/7.x<\/li>\n<li><strong>Updated<\/strong>: Requires at least WordPress 5.5 (was 5.0)<\/li>\n<li><strong>Updated<\/strong>: Tested up to WordPress 7.1<\/li>\n<\/ul>\n\n<h4>1.1.0<\/h4>\n\n<ul>\n<li><strong>New<\/strong>: Admin Bar Quick Toggle<\/li>\n<li><strong>New<\/strong>: Statistics Dashboard with reset button<\/li>\n<li><strong>New<\/strong>: Performance Mode (CSS only \/ JS only \/ both)<\/li>\n<li><strong>New<\/strong>: CDN \/ external file support<\/li>\n<li><strong>New<\/strong>: Admin notification when cache busting is active<\/li>\n<li><strong>New<\/strong>: Clear All Cache button (WordPress object cache + WP Super Cache, W3TC, WP Rocket)<\/li>\n<li><strong>New<\/strong>: Action hook <code>disable_css_js_cache_cleared<\/code> for developers<\/li>\n<li><strong>Improved<\/strong>: Settings page reorganised into sections<\/li>\n<li><strong>Fixed<\/strong>: Better local-path detection for subdirectory WordPress installs<\/li>\n<\/ul>\n\n<h4>1.0.9<\/h4>\n\n<ul>\n<li><strong>Fixed<\/strong>: Deactivate link not showing in the Plugins list<\/li>\n<li><strong>Fixed<\/strong>: Fatal errors caused by missing class-existence checks<\/li>\n<li><strong>Improved<\/strong>: Security \u2014 all output escaped; WP_Filesystem used for file I\/O; <code>wp_parse_url()<\/code> replaces <code>parse_url()<\/code><\/li>\n<li><strong>Improved<\/strong>: All settings sanitized with proper callbacks<\/li>\n<li><strong>Improved<\/strong>: Automatic <code>.htaccess<\/code> cleanup on deactivation<\/li>\n<li><strong>Added<\/strong>: Complete <code>uninstall.php<\/code> with multisite support<\/li>\n<\/ul>\n\n<h4>1.0.7<\/h4>\n\n<ul>\n<li>Browser caching headers feature added<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release<\/li>\n<\/ul>","raw_excerpt":"Prevent browser caching of CSS and JS files in WordPress and control static asset caching headers.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/174036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=174036"}],"author":[{"embeddable":true,"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/umangapps48"}],"wp:attachment":[{"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=174036"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=174036"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=174036"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=174036"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=174036"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ca.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=174036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}