The magic is that the one of the optional parameters of the enqueue_* functions is a version. We can use php’s filemtime function to get the last modified time of the file as a timestamp and use it for the version. Wordpress appends the version to the end of the url like “http://yoursite.com/wp-content/themes/your-theme/style.css?ver=1265429348”. Now you don’t have to worry about serving stale data since every time you edit the file the url will be updated.
Here is some example code:
1 2 3 4 5 6 7 8 9 10 11 12 13