It is very common to use W3 Total Caché plugin to optimize our WordPress loading time. This plugin provides lots of tools to achieve web caching: page cache, database cache, browser cache, minification, etc.
After uploading changes in a file (css, js or image) we don’t see any update. Probably if we force browser caché reload with Ctrl + F5, or just empty cache, we will be able to see the update.
How can we avoid our users to force their browser’s cache reload?
The solution to this ‘residual browser cache’ is the file versioning. Let’s see how does this work.
We have to add a suffix to the filename in every include in our theme or plugin. For example:
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>?v=0.1" />
In the previous example I have added the suffix ?v=XX, to the filename, where XX is the number of the version.
When we do any update on these files we have to change the number of the version (or revision) and clean the page cache in order to force browsers to update.
Comments, questions, suggestions?