keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

Purge AMP cache on post save / update #192

Closed janvitos closed 3 years ago

janvitos commented 3 years ago

Hi,

I noticed that when I save / update a post, the cache for AMP pages is NOT purged. Looking at the cache folders, I see that the /amp/ folder inside the main article folder has the same timestamp as before the update.

It would be great if the plugin would also purge the /amp subdirectory on post save / update. I know there are many different amp locations (/amp/, /?amp, /?amp=1, etc.) so it might be tricky to get them all purged.

Thank you.

coreykn commented 3 years ago

We don't plan on adding this type of handling in the current branch (1.6) but have it on our list to evaluate in the future. In the meantime the function in the following post can be used: https://wordpress.org/support/topic/amp-cache-is-not-cleared/#post-13809107

janvitos commented 3 years ago

I will check this out. Thanks.

coreykn commented 3 years ago

We do not plan on adding support for this directly to Cache Enabler. However, we are looking adding this type of support by introducing something like #229. That way snippets like I shared above can easily be added to extend Cache Enabler for specific uses cases, like clearing the AMP cache if the website is using an AMP plugin.