plugin-icon

Prevent Browser Caching

Prevents browser cache problems: visitors always get the current version of your CSS, JS, images and pages, while caching keeps working.
Puanlar
4.9
Sürüm
3.0.0
Aktif kurulumlar
10K
Son güncellenme
Jul 4, 2026
Prevent Browser Caching

You changed the site, but a client or visitor still sees the old version and you have to say “please clear your browser cache”? This plugin makes that conversation unnecessary.

Prevent Browser Caching makes sure browsers always load the current version of your site — without disabling browser caching and slowing the site down.

What it does

  • CSS & JS versions. WordPress loads assets with a “ver” URL parameter (e.g. style.css?ver=4.9.6). Browsers cache the file until this parameter changes. In the recommended automatic mode the plugin sets the version from the file’s own modification time: browser caching works at full strength, and the moment you update a file every visitor gets the new one.
  • Image versions. When you edit or replace a file in the Media Library, visitors get the new image instead of the cached one.
  • HTML page freshness. Asks browsers to check for a newer version of a page before showing a cached copy — fixes “I still see the old page on my phone”.
  • One-click update. The “Update versions” toolbar button forces fresh copies of all assets for every visitor.

Safe by default

  • External URLs (payment scripts, CDNs, third-party services) are left untouched — some of them break when an unexpected “ver” parameter is added. You can turn external versioning back on with one checkbox.
  • Specific files (by part of the URL) or script/style handles can be excluded from versioning — CSS, JS and images alike.
  • If a page-cache plugin is active, the HTML freshness headers step aside automatically.

Update modes

  • Automatically, when a file changes (recommended) — version = file modification time. Zero clicks, full caching.
  • Every time a page loads — development mode: CSS & JS are never cached (images and pages are unaffected). Use it only while actively developing.
  • Manually — versions change only when you press the “Update versions” button.

For developers

The recommended way to set the CSS/JS version from code is the pbc_assets_version filter. Add this to the functions.php file of your theme and change the value whenever you need to update assets:

add_filter( 'pbc_assets_version', function( $ver ) { return '123'; } );

Because it uses WordPress’s own add_filter(), it keeps working safely even if the plugin is ever deactivated — your site won’t break.

Filters for fine-tuning:

  • pbc_skip_src( $skip, $src, $handle ) — return true to leave a given asset URL untouched.
  • pbc_assets_version( $ver, $src, $handle ) — change the version applied to a given asset.

Legacy: earlier versions documented a prevent_browser_caching() function instead. It still works exactly as before — it disables the plugin’s admin settings and gives you full control — but I recommend the filter above: a bare function call in functions.php triggers a fatal error if the plugin is ever deactivated. If you keep using the function, guard it:

if ( function_exists( 'prevent_browser_caching' ) ) { prevent_browser_caching( array( 'assets_version' => '123' ) ); }

Thank you

Many of the improvements in 3.0.0 started as reports and questions in the support forum — thank you to everyone who took the time to describe a problem or share an idea. If something doesn’t work as expected on your site, please open a topic there: it genuinely helps make the plugin better for everyone.

Ücretsiz(ücretli paketlerde)
Kurulum işlemini tamamlayarak, WordPress.com'un Hizmet Şartları ile Üçüncü Taraf Eklenti Şartlarını kabul etmiş olursunuz.
Test edilen son sürüm
WordPress 7.0
Bu eklenti, sitenizde kullanılmak üzere indirilebilir.