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

improve cache clearing for post publishing, updating, and trashing actions #112

Closed coreykn closed 4 years ago

coreykn commented 4 years ago

When any post type is published and a static home page is defined the posts page should also be able to be cleared (if defined). The post ID for the posts page can be obtained with get_option( 'page_for_posts' ) (the value returned will be 0 if undefined).

When updating a post there should be more control over what should be cleared, like the home page, posts page (if applicable), etc. This was considered in PR #88 when changing the default publishing action and it turns out it would be a good enhancement. This same functionality should be added to Gutenberg as it currently is in the Classic Editor.

WordPress topics:

BWBama85 commented 4 years ago

I was just searching for this and I agree. Great to see you created it just yesterday. It is annoying to update a post or page type and then have to manually clear the cached page.

BWBama85 commented 4 years ago

Just to be clear that I am on the same page with this, when I update a page (not a post) is the cache supposed to be cleared on that update? If so, this is not the behavior I have seen. When I update a page, which I often do daily do to the way that we use pages, the page is not cleared from the cache and I have to manually clear that URL.

DJviolin commented 4 years ago

I'm seeing this issue with Generatepress v3 and Gutenberg. I update my page and not updating it's cache.

coreykn commented 4 years ago

After many iterations I came to the solution that I liked, which ended up being completely replacing how the cache is currently cleared on post actions. I'm really excited about this change. If you feel like reading a novel the above PR should help answer any questions. I've highlighted the main changes related to this issue below otherwise:

If you have any questions or feedback (especially on the updated settings layout) just let me know.

BWBama85 commented 4 years ago

This is great. Thank you!