Why doesn’t Comet Cache remove query strings from static resources?
Many speed testing services such as Google PageSpeed and GTMetrix will reduce your overall score if you don't "Remove Query Strings From Static Resources". What these services don't consider, however, is that a dynamic site running a Content Management System (CMS) such as WordPress must use query strings for static resources to ensure that everything stays up-to-date.
wp_enqueue_script() and CSS files (
wp_enqueue_style()): both include a Version Parameter, which allows the plugin or theme developer to specify the version number of the file being loaded. That version number then gets appended to the static resource link as a query string (e.g.,
If a plugin or theme developer chooses not to use this Version Parameter, WordPress will go ahead and add one on its own. See the following from the WordPress Codex regarding the Version Parameter:
String specifying the script version number, if it has one, which is concatenated to the end of the path as a query string. If no version is specified or set to false, then WordPress automatically adds a version number equal to the current version of WordPress you are running. If set to null no version is added. This parameter is used to ensure that the correct version is sent to the client regardless of caching, and so should be included if a version number is available and makes sense for the script.
Why is a version number necessary?
In a WordPress environment, you will be running many different plugins, each with its own version. You'll also be using a WordPress theme, which also has a specific version and will get updated from time to time.
How do we change the link to each file without actually needing to change the names of the files every time something is updated? We do that by changing the version number at the end of the file, e.g.,
theme-style.css?ver=1.5 might become
theme-style.css?ver=1.6 after a theme update. When we change the version number, we change the link to the file, which tells visiting web browsers and your CDN to fetch the newest copy of the file.
?ver=1.6 portion is the "Query String". If we removed that query string--as many speed testing services recommend--then your WordPress site wouldn't function properly. Your visitors would end up seeing old versions of your site!
It's for this reason that Comet Cache does not remove query strings from static resources--doing so would essentially break your WordPress site.