Title: Image not replaced when using object cache
Last modified: January 22, 2026

---

# Image not replaced when using object cache

 *  [Guillaume G.](https://wordpress.org/support/users/g4ll4is/)
 * (@g4ll4is)
 * [4 months, 2 weeks ago](https://wordpress.org/support/topic/image-not-replaced-when-using-object-cache/)
 * Hi,
   Enable Media Replace doesn’t replace images in content when using an object
   cache plugin. Media replacement succeeds, but the media isn’t updated in content.
   Instead, the original image disappears (404) and nothing is shown.
 * Before replacing the media :
 * ![](https://i0.wp.com/whoz.me/all/issue/sample-original.png?ssl=1)
 * After replacing :
 * ![](https://i0.wp.com/whoz.me/all/issue/sample-replaced.png?ssl=1)
 * Step to reproduce :
    1.  Install an Object cache plugin (see list below)
    2.  In the plugin settings, activate Object cache
    3.  Upload a media to the media library
    4.  Add the media to a sample page and publish it
    5.  With EMR, replace the media using these settings :
    6.   - Replace the file, use the new file name, and update all links
         - Replace the date with the current date
    7.  From the front end, access the sample page and add `?nocache` to the end of
        the URL
    8.  Open the browser devtools “Network” tab, disable cache and reload the page
    9.  The original media is gone, and the replaced version doesn’t show
 * This issue has been tested with an blank, up-to-date WordPress installation, 
   and only Enable Media Replace (4.1.7) and an Object cache plugin installed.
 * It was successfully reproduced with the following plugins :
    - APCu Manager (4.3.0)
    - atec Cache Info (1.8.31)
    - Docket Cache (24.07.05)
    - SQLIte Object cache (1.6)
    - Redis Object Cache (2.7)
 * Issue occurred both on LiteSpeed and Apache servers, hosted by four different
   hosting companies. So I do think that the problem lies on Enable Media Replace
   side.
 * Disabling Object cache or removing the cache plugin solves the issue.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Support [Adrian](https://wordpress.org/support/users/adrianrus/)
 * (@adrianrus)
 * [4 months, 2 weeks ago](https://wordpress.org/support/topic/image-not-replaced-when-using-object-cache/#post-18795380)
 * Hi [@g4ll4is](https://wordpress.org/support/users/g4ll4is/) ,
 * Thank you for your message! I’m sorry to hear about this issue 🙁
 * Could you please confirm that not even purging the cache from the object cache
   plugin fixes the issue after the image has been replaced?
 * Looking forward to your reply so we can investigate this further!
 * All the best,
 *  Thread Starter [Guillaume G.](https://wordpress.org/support/users/g4ll4is/)
 * (@g4ll4is)
 * [4 months, 2 weeks ago](https://wordpress.org/support/topic/image-not-replaced-when-using-object-cache/#post-18795866)
 * Purging the object cache does fix the issue. The new image shows in content after
   that.
 * But purging only works when _any other cache_ is disabled, which is rarely the
   case in production. With other caching systems active (page, opcache, CDN), purging
   object cache _doesn’t fix anything_.
   As object cache fails, others caching systems
   will store and serve outdated info. You end up purging every cache system to 
   restore the rightful media.
 * FYI I’ve first discovered this issue in late 2024, using EMR 4.1.5. But I wasn’t
   able to reproduce it back then, and this took me some time to pinpoint what was
   wrong.
 *  Plugin Support [Adrian](https://wordpress.org/support/users/adrianrus/)
 * (@adrianrus)
 * [4 months, 2 weeks ago](https://wordpress.org/support/topic/image-not-replaced-when-using-object-cache/#post-18795933)
 * Hi again, [@g4ll4is](https://wordpress.org/support/users/g4ll4is/) ,
 * Unfortunately, this doesn’t seem to be an EMR issue, it seems to be a normal 
   caching issue.
 * The plugin replaces the image correctly, but you’ll need to clear your caching
   afterward to ensure the updated image displays properly. When multiple caching
   layers are active, there’s always a risk of showing outdated content if the cache
   isn’t purged, this is because EMR cannot purge the cache from other plugins.
   
   After replacing an image with EMR, you need to purge both the normal cache and
   object cache. Once cleared, the new image should display correctly!
 *  [Pierre Lannoy](https://wordpress.org/support/users/pierrelannoy/)
 * (@pierrelannoy)
 * [4 months, 1 week ago](https://wordpress.org/support/topic/image-not-replaced-when-using-object-cache/#post-18803064)
 * Hello [@adrianrus](https://wordpress.org/support/users/adrianrus/) !
 * > [@adrianrus](https://wordpress.org/support/users/adrianrus/)
   >  Unfortunately, this doesn’t seem to be an EMR issue, it seems to be a normal
   > caching issue.
 * I’m sorry, but I don’t entirely agree with that… It is the “responsibility” of
   the process that modifies content to inform the object cache manager that the
   content is stalled.
   In this present case, EMR must explicitly delete the cached
   versions of the media: it is the only one that knows that the cached media is
   no longer valid… `wp_cache_delete()` is your friend 😉
 *  Plugin Author [Pedro](https://wordpress.org/support/users/petredobrescu/)
 * (@petredobrescu)
 * [4 months, 1 week ago](https://wordpress.org/support/topic/image-not-replaced-when-using-object-cache/#post-18803933)
 * Hello [@pierrelannoy](https://wordpress.org/support/users/pierrelannoy/) and 
   thanks for your reply!
 * We are already [using WP’s cache flushing methods](https://github.com/short-pixel-optimizer/enable-media-replace/blob/master/classes/cache.php#L67-L71),
   including `wp_cache_delete()`, so this is not the real issue here. Most likely,
   we need to integrate with the plugins above. We’re running tests by default with
   memcached and the default WordPress object caching, which works without issues.
   We’ll do our best to run tests with the plugins listed above and see what we 
   can do to achieve the cache flushing needed for a seamless experience.
 * I take this opportunity to mention that this is a free plugin, and we always 
   welcome pull requests with such integration/fixes in our GitHub repository:
 * [https://github.com/short-pixel-optimizer/enable-media-replace](https://github.com/short-pixel-optimizer/enable-media-replace)
 * All the best

Viewing 5 replies - 1 through 5 (of 5 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fimage-not-replaced-when-using-object-cache%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/enable-media-replace/assets/icon-256x256.png?rev=1940728)
 * [Enable Media Replace](https://wordpress.org/plugins/enable-media-replace/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/enable-media-replace/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/enable-media-replace/)
 * [Active Topics](https://wordpress.org/support/plugin/enable-media-replace/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/enable-media-replace/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/enable-media-replace/reviews/)

 * 5 replies
 * 4 participants
 * Last reply from: [Pedro](https://wordpress.org/support/users/petredobrescu/)
 * Last activity: [4 months, 1 week ago](https://wordpress.org/support/topic/image-not-replaced-when-using-object-cache/#post-18803933)
 * Status: not resolved