Remove Query String on Static Resources
Tools such as Pingdom, GT Metrix, and PageSpeed often recommend to remove the query string from static resources.
In WP Rocket 2.9 we introduced the Static Resources option to satisfy this recommendation. It is found in the Advanced tab:
By enabling this option, we don’t just remove the query string, since that will cause browser caching issues, we also encode the version number into the URL, to maintain the browser ‘cache-busting’ value, while satisfying GT Metrix.
So if you have a filename like style.css?ver=1.0, it will become style-1.0.css, and will update accordingly when the version changes, so your users will always receive the latest version of the file. Please see our “plain English” guide on how browser caching works for more information.
The files generated by WP Rocket are stored in: wp-content/cache/busting
Your source code will look something like this, with the option applied:
☝️ Note: If you enable the Static Resources option, it will (like LazyLoad) be applied even on pages where caching is disabled.
If you are using a version of WP Rocket prior to 2.9, we do not recommend removing the query string with a plugin or function that does not also encode the version into the URL. This is not recommended for the following reason:
Let's say you have a CSS file with the name style.css.
If you have browser caching enabled for CSS files and you update style.css, users are not going to see the update, because the browser already has style.css in its cache.
However, if you have style.css?ver=1, and you update the file, it will produce a new filename: style.css?v=1.1
This will allow users to see the update without clearing their browser cache.
In short, your site visitors will always see the correct version of your CSS and other files when a query string with a version is appended as WordPress does per default.