Closed coreykn closed 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.
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.
I'm seeing this issue with Generatepress v3 and Gutenberg. I update my page and not updating it's cache.
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:
Removed publishing action in sidebar on Classic Editor in favor of clearing the page cache of any updated post type by default (e.g. post
, page
, product
, etc.). This means page cache will always be cleared in any way that any post type is updated, whether that is an editor, such as the Classic Editor or Gutenberg, or even an API.
Add new method to clear the associated cache. This will clear the cached pages that might contain a page that has been cleared. Currently this is the post type archives (e.g. home page or defined posts page, shop page, etc.), taxonomies archives (e.g. categories and tags), author archives, and date archives.
Update the default behavior to clear the associated cache when any post type is published (instead of only the home page cache).
Update the default behavior to clear the associated cache when any published post type is trashed (instead of the complete cache).
Add new pagination
clear type to clear the pagination page(s) cache (e.g. https://www.example.com/blog/page/2/
or https://www.example.com/blog/seite/2/
). This will ensure the pagination is cleared on any archives page.
Update settings layout.
If you have any questions or feedback (especially on the updated settings layout) just let me know.
This is great. Thank you!
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 be0
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: