• Resolved René

    (@mobiflip)


    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é

    (@mobiflip)

    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é

    (@mobiflip)

    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 4 years, 4 months ago by René.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘complete cache is deleted’ is closed to new replies.