As it happens, WordPress has a great mechanism for taking care of this, you can put versioning on wp_enqueue_script and wp_enqueue_style.
This is totally my responsibility. I had copied 2 lines of code from an existing plugin that I was using, but an important developer rule is that once you’ve copied some code, you must take responsibility for it! So my mistake, but here’s the mistake I made
I’d copied and modified these two lines of code.
wp_register_script('byw-manage-campaign', plugins_url('js/byw-manage-campaign.js', __FILE__), array('jquery', 'jquery-effects-slide', 'jquery-effects-core'), true); wp_enqueue_script('byw-manage-campaign');
The last parameter in that wp_register_script is the “ver” parameter, which is set to true here.
But changing true to an actual version number ( AND then remembering to update it whenever you change the file ) will cause the file to not be loaded from a cache anywhere down the line.
wp_register_script('byw-manage-campaign', plugins_url('js/byw-manage-campaign.js', __FILE__), array('jquery', 'jquery-effects-slide', 'jquery-effects-core'), "1.01"); wp_enqueue_script('byw-manage-campaign');
Note that we’re not getting rid of caching completely. Once this new version of the file has been loaded by a client (or CDN server or whatever), it still has the opportunity to save that in the cache and load the cached version in the future – until you increase the version number next time.
Read More Articles: