Breaks the basic idea of caching and versioning
-
Removing version parameters from URLs is generally a very bad idea, even though many test tools complain about “unneeded” parameters for static resources – which is in my opinion completely pointless.
The problem of removing version parameters from URLs of styles and scripts in WordPress:
Whenever WordPress itself or a theme or a plugin gets updated, the browsers will not load the new version of these resources as long as they still have an older version in their local cache.
A browser loads
https://mysite.example/style.css?ver=1.0
once and keeps it in its cache for a week or even longer, depending on the server configuration. And yes, this is good! Less requests are always better!Now when the theme gets updated the version parameter changes – for example from 1.0 to 2.0. So the new URL will be
https://mysite.example/style.css?ver=2.0
. Now the browser will send a new request, as this URL is not in the cache yet – the old version will get removed after the expiration time anyway, so it does not matter when there are two versions in the cache. But the important point is, that in any case the browser will load the updated version when needed and never use an outdated cached copy!But when removing the
?ver=1.0
the URL will always be the same, even when the resource already got updated. Users may see a non working web site after an update since their browsers will not try to load the newer version as the URL did not change even after an update.So – do not remove these parameters! If you really can’t stand the complaints by YSlow or PageSpeed etc. then try another aproach by moving “ver” to the URL and applying a rewrite rule which will then change this part of the URL back to a parameter internally:
- The topic ‘Breaks the basic idea of caching and versioning’ is closed to new replies.