Title: complete cache is deleted
Last modified: November 18, 2020

---

# complete cache is deleted

 *  Resolved [René](https://wordpress.org/support/users/mobiflip/)
 * (@mobiflip)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/complete-cache-is-deleted/)
 * after the update to version 1.6.0 the complete cache is deleted as soon as a 
   post is published. the option for this is **not** active. i have the following
   hooks active
 *     ```
       function clear_pagination_cache_on_publish_post() {
           if ( class_exists( 'Cache_Enabler' ) ) {
               Cache_Enabler::clear_page_cache_by_url( get_home_url() );
               Cache_Enabler::clear_page_cache_by_url( 'https://www.site.de/page/', 'dir' );
               Cache_Enabler::clear_page_cache_by_url( 'https://www.site.de/ticker/', 'dir' );
               Cache_Enabler::clear_page_cache_by_url( 'https://www.site.de/ticker/' );
           }
       }
   
       add_action( 'publish_shortnews', 'clear_pagination_cache_on_publish_post', 10, 2 );
       add_action( 'publish_post', 'clear_pagination_cache_on_publish_post', 10, 2 );
   
       function clear_post_cache_on_edit_post() {
           if ( class_exists( 'Cache_Enabler' ) ) {
               Cache_Enabler::clear_page_cache_by_url( get_permalink(), 'dir' );
           }
       }
   
       add_action( 'edit_shortnews', 'clear_post_cache_on_edit_post', 10, 2 );
       add_action( 'edit_post', 'clear_post_cache_on_edit_post', 10, 2 );
       ```
   
 * With version 1.5.5 everything worked as it should.
 * _any idea?_

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

 *  Thread Starter [René](https://wordpress.org/support/users/mobiflip/)
 * (@mobiflip)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/complete-cache-is-deleted/#post-13678076)
 * i have noticed some strange behaviour. if i edit an unpublished post, the whole
   cache is deleted. if i edit an already published post, this does not happen.
 *  Thread Starter [René](https://wordpress.org/support/users/mobiflip/)
 * (@mobiflip)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/complete-cache-is-deleted/#post-13678725)
 * oh man, that took time. 😄 here my solution:
 *     ```
       function clear_pagination_cache_on_publish_post() {
           if ( class_exists('Cache_Enabler' )) {
               Cache_Enabler::clear_page_cache_by_url( get_home_url(), 'pagination' );
               Cache_Enabler::clear_page_cache_by_url( 'https://www.site.de/ticker/', 'pagination' );
           //  Cache_Enabler::clear_page_cache_by_url( 'https://www.site.de/page/', 'subpages' );
           //  Cache_Enabler::clear_page_cache_by_url( 'https://www.site.de/ticker/' );
           }
       }
   
       add_action( 'publish_shortnews', 'clear_pagination_cache_on_publish_post', 10, 2 );
       add_action( 'publish_post', 'clear_pagination_cache_on_publish_post', 10, 2 );
   
       function clear_post_cache_on_edit_post() {
           if ( class_exists('Cache_Enabler' ) && get_post_status() == 'publish') {
               Cache_Enabler::clear_page_cache_by_url( get_permalink(), 'subpages' );
           }
       }
   
       add_action( 'edit_shortnews', 'clear_post_cache_on_edit_post', 10, 2 );
       add_action( 'edit_post', 'clear_post_cache_on_edit_post', 10, 2 );
       ```
   
 * it would be nice if someone would look over it and say if it could be used that
   way without any problems?
    -  This reply was modified 5 years, 7 months ago by [René](https://wordpress.org/support/users/mobiflip/).

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

The topic ‘complete cache is deleted’ is closed to new replies.

 * ![](https://ps.w.org/cache-enabler/assets/icon.svg?rev=2442383)
 * [Cache Enabler](https://wordpress.org/plugins/cache-enabler/)
 * [Support Threads](https://wordpress.org/support/plugin/cache-enabler/)
 * [Active Topics](https://wordpress.org/support/plugin/cache-enabler/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cache-enabler/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cache-enabler/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [René](https://wordpress.org/support/users/mobiflip/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/complete-cache-is-deleted/#post-13678725)
 * Status: resolved