WP – ENQUEUE STYLE TO AVOID CACHE DURING DEVELOPMENT (Force Reload of Scripts and Stylesheets in your Plugin or Theme)

		
		
			

But to change the version number manually every time in the development stage would be a bit
tedious and you’re a programmer, right? So let’s automate this:

The value of time() changes every second so the version ID of the file changes constantly and it’s reloaded from the source and not from some cache.

It’s a bit disadvantageous that you have to substitute the time based version parameter by a “real”
version number every time you deploy your code since the actual user
still should have the benefits of cached scripts and stylesheets. Let’s extend the idea:

This way you can make sure that in your development environment everything is reloaded from the source all the time but a
productive server takes advantage of caches.