2013-04-04, 15:52:26
Hi all,
I'm hoping there is some way I can add a timestamp to images within the content in order to prevent caching, but I'm not really keen to alter the core code. Can this be done with a function?
For example, within my client's template is <img src="<?php get_site_url(); ?>/data/uploads/image.jpg?<?php echo date("W");?>" /> which simply adds the week number to the end of the image, and means the image will not be cached forever until the user clears it.
How can I add the same timestamp to certain images which are called from within the content editor to prevent them being cached too? The images will be updated once every week or two, but the page content does not necessarily change.
If I HAVE to edit the core code, so be it (though I have no idea where) - but surely someone smarter than me can advise how I could create a function to achieve this.
Much appreciated!
I'm hoping there is some way I can add a timestamp to images within the content in order to prevent caching, but I'm not really keen to alter the core code. Can this be done with a function?
For example, within my client's template is <img src="<?php get_site_url(); ?>/data/uploads/image.jpg?<?php echo date("W");?>" /> which simply adds the week number to the end of the image, and means the image will not be cached forever until the user clears it.
How can I add the same timestamp to certain images which are called from within the content editor to prevent them being cached too? The images will be updated once every week or two, but the page content does not necessarily change.
If I HAVE to edit the core code, so be it (though I have no idea where) - but surely someone smarter than me can advise how I could create a function to achieve this.
Much appreciated!