How to Remove Query Strings From Static Resources in WordPress

How to Remove Query Strings From Static Resources in WordPress

Look at the source code of almost any WordPress site and you’ll see CSS and JavaScript files ending in something like ?ver=6.8.2. Speed testing tools have long flagged these as “query strings on static resources,” and many site owners want them gone. This guide explains what those version strings do, when removing query strings in WordPress actually helps, and how to do it safely with a plugin or code.

What Are Query Strings on Static Resources?

WordPress adds a version number to every stylesheet and script it loads:

/wp-content/themes/my-theme/style.css?ver=2.1.0
/wp-includes/js/jquery/jquery.min.js?ver=3.7.1

The version usually comes from the theme, plugin or WordPress release. When a plugin updates, its version number changes, which forces browsers to download the new file instead of using an old cached copy. This is called cache busting.

Why Remove Query Strings?

  • Some CDNs and proxies are configured not to cache URLs that contain query strings, which can reduce caching efficiency.
  • Older speed tools, such as earlier versions of GTmetrix and Pingdom, penalised them, and clients still ask about it.
  • Cleaner URLs make page source easier to read and hide exact plugin versions from casual inspection.

When You Should Not Remove Them

Be honest with yourself about the trade-off. Modern CDNs such as Cloudflare cache static files with query strings by default, and Google’s PageSpeed Insights doesn’t flag them. Removing the version also removes cache busting, which means visitors may keep seeing an old stylesheet after an update until their browser cache expires.

Remove them if… Keep them if…
Your CDN or proxy won’t cache URLs with query strings You use a modern CDN that caches them already
A client or audit specifically requires it You update themes and plugins often and need instant cache busting
You want to hide plugin version numbers You don’t have a way to purge browser caches after updates

How to Remove Query Strings With a Plugin

Automatic Asset Version Killer from Simpli Plugin is a free plugin that removes version query strings from your scripts and stylesheets automatically.

  1. Download the plugin ZIP from its product page.
  2. Go to Plugins → Add New Plugin → Upload Plugin.
  3. Upload the file, click Install Now, then Activate Plugin.
  4. Clear your caching plugin and CDN cache.
  5. View your page source and confirm the ?ver= parameters are gone.

How to Remove Query Strings With Code

Add this to a small custom plugin or a child theme:

function simpli_remove_asset_version( $src ) {
    if ( strpos( $src, 'ver=' ) !== false ) {
        $src = remove_query_arg( 'ver', $src );
    }
    return $src;
}
add_filter( 'style_loader_src', 'simpli_remove_asset_version', 9999 );
add_filter( 'script_loader_src', 'simpli_remove_asset_version', 9999 );

The high priority (9999) makes the filter run after other plugins have added their URLs. It only removes the ver parameter, leaving any other query arguments intact.

Not sure which speed changes will actually move your scores? Simpli Plugin’s team can audit your site and fix what matters, instead of chasing every warning.

Request a Speed Audit →

Keep Cache Busting Working After Removal

Once versions are removed, plan how visitors will receive updated files:

  • Purge your CDN and page cache after every theme or plugin update.
  • Use shorter browser cache times for CSS and JS, such as one week instead of one year, if updates are frequent.
  • Rename files on major theme changes, for example style-v2.css, if you build your own theme.

How to Check It Worked

  1. Open your site in a private browser window.
  2. View the page source and search for ?ver=.
  3. Run the page through your speed testing tool and compare results.

Common Problems and How to Fix Them

The Layout Looks Broken After an Update

Visitors are using a cached copy of an old stylesheet. Purge all caches, and ask users to hard-refresh with Ctrl+Shift+R.

Some Files Still Have Query Strings

Files added directly in theme templates or loaded by third-party scripts don’t pass through WordPress’s loader filters. Those need to be edited at their source.

No Speed Improvement

That’s common on modern CDNs. Focus on bigger wins: image compression, caching and removing unused plugins.

Frequently Asked Questions

Do query strings hurt SEO?

No. Google doesn’t penalise versioned CSS or JS files. Any effect is on caching, not rankings.

Is removing query strings safe?

Yes, as long as you purge caches after updates so visitors receive new files.

Does it work with WooCommerce?

Yes. WooCommerce assets load through the same WordPress functions, so their version strings are removed too.

Can I remove versions from only some files?

Yes, with custom code that checks the file URL before removing the parameter.

Make an Informed Speed Decision

Removing query strings is a small, reversible change. Do it when your CDN or an audit calls for it, and pair it with a cache-purging routine so updates still reach visitors.

Download Automatic Asset Version Killer for free, and explore more lightweight WordPress plugins from Simpli Plugin.

Talk to Our Developers →