View Categories

In Enable Media Replace the image isn’t replaced. Why?

Almost always the file 
is actually replaced when using Enable Media Replace (EMR), but it cannot be seen because the cache of your website is storing the old version. It’s very easy to check whether that’s your case by trying to directly access the URL of an image after adding ?anything at the end of the URL. Please note that after ? you can add any random string you want; this trick is used to bypass any caching layer from your browser to the file.

For example, if the URL of your image is

https://blog.shortpixel.com/wp-content/uploads/2019/01/rawpixel-1064367-unsplash-768x462.jpg

and you add
?random at the end, the URL you’ll need to check is

https://blog.shortpixel.com/wp-content/uploads/2019/01/rawpixel-1064367-unsplash-768x462.jpg?random

If the images you see using this technique are different (you can see the old one and the new one), then there is definitely a caching issue, completely unrelated to Enable Media Replace. There can be different types of cache along the way from your browser to your website, so we suggest to have a careful read at How to clear WordPress cache.

Please also notice the following:

  • Sometimes, we noticed that there is also a server-side cache active and none of the steps above will actually flush the cache. If you feel this could be your case, then please contact your hosting provider, show them the two URLs and ask them for their support.
  • If you are using JetPack’s site accelerator component for images, disable it (it caches your images) and try ShortPixel Adaptive Images instead.

If you see the same image when you use the technique described above, it means that the image was not replaced. There’s two possible causes:

  • There is an issue with file permissions which you may want to check with your hosting provider.
  • You are replacing a big image with a smaller image. Enable Media Replace generates new thumbnails for the new image, therefore if you had a 2000×2000 thumbnail published on a post/page, and then you replace the original image with a 600×600 image, the 2000×2000 thumbnail will become orphan because the new original image is smaller. However, you may still see it because of your browser cache.

    In some cases, the solution may be to use the option “Replace the file, use new file name and update all links” before replacing the image.