Remove Query String from Static Resources

⛔️ Deprecated: This feature was removed in WP Rocket 3.6 because it does not impact loading time and is no longer recommended by GT Metrix.

Tools such as Pingdom, GT Metrix, and PageSpeed often recommend to remove the query string from static resources. However, their recommendation often lack context, so they may or may not make sense for any random file URI.

WP Rocket provides a handy 1-click checkbox to remove query strings:

However, not all query strings are created equal. Some can and will be removed, some could possibly, but will not be removed for safety reasons, and some cannot be removed without breaking your website.

Browser cache and cache busting

Tip: Read Browser Caching, Explained In Plain English on our blog to learn more about how browser caching works.

“Cache busting” is the concept of not applying query strings to file URIs, but still indicating file changes to browsers.

One way of implementing cache busting is to simply change the file name when a file has been updated. The browser would check for the old file name and not find it, so it would remove the previously cached file from its cache and download the new file.

When WP Rocket removes a query string, it follows that exact concept: Not only gets the query string removed, but WP Rocket generates a copy of the original file with the query string value encoded into the file name.


// Original file URI with query string:

// Copy generated by WP Rocket:

The files generated by WP Rocket are stored in a dedicated directory inside of the cache folder:


Your source code will look something like this, with the option applied:

Not all query strings get removed, why?

WP Rocket only removes the default ?ver= query string from WordPress. This is by design:

Some plugin or theme might use a different query string for critical functionality. For example, the Photon feature of Jetpack would use a query string to fetch image sizes. So if WP Rocket removed all query strings, no matter what, it would likely break some functionality on a website. 

Query strings on external URIs (i.e. files from any other domain than your own) will not get removed due to general implications of  handling external resources.

Don’t use simplified solutions!

We strongly recommend not to remove query strings with a plugin or function that does not also encode the version into the URI. Unless proper cache busting can be guaranteed, query strings are imperative for your website to be displayed correctly.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.