Hi Gabriel,
That sounds like a caching issue, but just to be sure, have you taken a look at the following article? https://help.shortpixel.com/article/158-in-enable-media-replace-the-image-isnt-replaced-why
Thanks for your response.
After further investigation, this is related to the usage of object cache pro on our site. Adding an action to programmatically flush the cache when “emr/cache/flush” is triggered solved it.
Excellent, thanks for your input, Gabriel!
Plugin Author
Pedro
(@petredobrescu)
hello @gdetassigny,
Thanks again for letting us know what was the solution. Can you also tell me what is the cache flush hook/action/function for the object cache pro? I’m thinking about adding this integration directly in our plugin, to avoid such issues for other customers as well.
Thank you!
Hi,
I directly called:
wp_cache_flush();
and that seems to work fine.
If you wanted to handle it using Object Cache Pro’s internal, you could do it this way too:
global $wp_object_cache;
$wp_object_cache->flush();
This implementation works, but it’s not ideal as it means the entire object cache is being flushed. Ideally I would prefer to be able to flush all related posts that got modified (I’m using the “Replace the file, use the new file name, and update all links” so I would need to call the clean_post_cache() function for each post that were modified). Is there a way to achieve this? I couldn’t find any hook within enable-media-replace plugin to be able to know which posts were modified