Works at MediaTemple (so far)
-
At MediaTemple, they have a very nice WordPress hosting package that’s pretty zippy, what with server-side caching and so forth. However, for some reason their Staging server, where you can work on your code behind the scenes before going live, ALSO has this server-side caching going on. So, you find yourself clicking on the “Flush Cache” button every time you make a change. For images, it’s worse, because there are far-flung headers or something that basically make the browser ignore the fact that sure, you just uploaded a replacement image, but that image is not going to be visible for several hours.
So I tried using this plugin to see if the image urls would be freshened, and it works pretty well. Only, I now find myself needing to go to the plugin to refresh it, too. So as a workaround, I dug into the code and found a spot where I can put in the time() function to get a unique number appended.
Around line 63:
return add_query_arg('ver', str_pad( $options['increment'], 3, '0', STR_PAD_LEFT ) . time() , $src);I just added the . time() function, which assures a unique number.
Now I only need to go to the “Flush Cache” menu every now and then; this seems to work pretty reliably so far.
<link rel=’stylesheet’ id=’newstyle-css’ href=’http://1c0.b3c.myftpupload.com/wp-content/themes/mytheme/style.css?ver=0071441121962′ >
So now all of my img, style, js hrefs have 0071441121962 appended, resulting in pretty fresh cache-busted elements!
It would be great if this was another option in the plugin’s settings.
https://wordpress.org/plugins/wp-version-in-query-string-modifier/
The topic ‘Works at MediaTemple (so far)’ is closed to new replies.