Caching problems with replaced images
-
The plugin adds a new
ver
parameter to the URL of the image if it had been replaced in order to force browsers to get the new image, rather than using a cached version. That’s great, however, the parameter is inserted in thewp_prepare_attachment_for_js
hook and that seems to fire only when an image is inserted in the block editor (and not even then if using the default Image block in Gutenberg for some reason). This means that if an image is replaced, all existing references to it still don’t have thever
parameter (or have an old timestamp) and so users’ browsers may not show the updated image.I tested this by adding an image to a page using the default WordPress image block as well as a third party image block (Greenshift), and then replacing the image. The
ver
parameter was not added to either. Then I reinserted that image in the block editor and thever
parameter was added to the URL only for Greenshift’s image block.I think the
ver
parameter should be added/updated for all references to an image when it is replaced. I understand this may be tricky because the URL is hardcoded in the post/page content and only updated when the image is reinserted into the editor, but there are ways to update it and I think it’s important. I believe the whole point of the media replace feature is so that one doesn’t need to go and reinsert the image in the editor, everywhere it is used, when wanting to update it.
- The topic ‘Caching problems with replaced images’ is closed to new replies.