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

Almost always the image/file is actually replaced when using Enable Media Replace (EMR) but because of cache the new image/file cannot be seen. 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 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 you see the same image when you access the two URLs, there's two possible causes:

  • There is an issue with file permissions and you may want to check that 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 2000x2000 thumbnail published on a post/page, and then you replace the original image with a 600x600 image, the 2000x2000 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.

If the images you see using the technique described above are different (you can see the old one and the new one) then there is definitely a caching problem and not a problem with Enable Media Replace. There can be different types of cache along the way from your browser to your website, so we suggest you:

  • Clear the cache of your cache plugin, like WP Rocket, W3 Total Cache, WP Fastest Cache and so on.
  • If you're using Cloudflare, flush the caching there as well.
  • Empty the browser's cache.
  • 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.

Still need help? Contact Us Contact Us