My workflow is sometimes the following:
The media library retains and display shows the old images as thumbnails and previews, even though they are deleted.
Obviously this problem is avoidable by adding images with distinct file names, but I wondered if there were some better way that works regardless of naming convention. Or something else that I’m completely missing?
@t31os Thanks for your response. I’m
sure it is just my browser caching the
images. But (I should have specified)
I’m not the only user. I’d prefer not
to have to tell my users to refresh
every time they delete something or
the clunkiness of building in a page
refresh as part of image deletion.
But, that’s just why we have browser caching — to prevent the same image from loading everytime we call it again. The browser sees it as the same image.
This is a browser cache issue, not a WordPress media library issue. The reason you see the old images in the media gallery is because you used the same file name and your browser is trying to save time and bandwidth by loading the versions it already has.
There are two ways to solve this problem.
Add a query variable (
You can tell your server (Apache) to set a custom “expires” date and time for different images either based on the extension (all jpg or png files) or the filename, if you want to get really granular. This is more of an advanced trick, but you can use this to immediately flush everyone’s cache whenever you upload new images.