• Resolved rlensen

    (@rlensen)


    Dear,

    First big thumbs up for this plugin. Massive difference can be seen in loading times.

    One thing I noticed when using it in combination with Buddyboss for forums (which is basically BBPress). When a new post is added /deleted to a topic the cache for that topic NOT is updated.

    [2022-02-18 11:28:27] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 1174743 and related contents - Fired action: wp_trash_post
    [2022-02-18 11:28:27] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 1174743 and related contents - Fired action: clean_post_cache
    [2022-02-18 11:28:27] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 1174743 and related contents - Fired action: clean_post_cache
    [2022-02-18 11:28:27] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 1174743 and related contents - Fired action: edit_post
    

    Should there be an additional action like purge cache of the parent topic.

    When I manually purge the cache of the Topic it is working

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter rlensen

    (@rlensen)

    I think I got it working, with this snippet:

    add_action( 'bbp_new_reply_post_extras', 'cf_purge_cache_reply' );
    add_action( 'bbp_edit_reply_post_extras', 'cf_purge_cache_reply' );
    add_action( 'wp_trash_post', 'cf_purge_cache_reply' );
    
    add_action ('bbp_new_topic_post_extras' , 'cf_purge_cache_topic' ) ;
    add_action ('bbp_edit_topic_post_extras' , 'cf_purge_cache_topic' ) ;
    
    add_action ('bbp_new_forum_post_extras' , 'cf_purge_cache_forum' ) ;
    add_action ('bbp_edit_forum_post_extras' , 'cf_purge_cache_forum' ) ;
    
    function cf_purge_cache_forum ($forum_id) {
    	// Bail if no forum
        $forum_id = get_post( $forum_id );
        if ( empty( $forum_id ) )
            return;
    	$url = get_permalink($forum_id);
    	if($url) {
    		do_action("swcfpc_purge_cache",  array( $url) );		
    	}
    }
    	
    function cf_purge_cache_reply ($reply_id) {
    	// Bail if no post
        $reply_id = get_post( $reply_id );
        if ( empty( $reply_id ) )
            return;
    	if (function_exists ('bbp_get_reply_topic_id')){
    		$topic_id = bbp_get_reply_topic_id ($reply_id) ;
    		cf_purge_cache_topic ($topic_id) ;
    		$forum_id = bbp_get_topic_forum_id($topic_id);
    		cf_purge_cache_forum($forum_id);
    	}
    }
    
    function cf_purge_cache_topic ($topic_id) {
    
    	$topic_id = get_post( $topic_id );
        if ( empty( $topic_id ) )
            return;
    	
    	$url = get_permalink($topic_id);
    	if($url) {
    		do_action("swcfpc_purge_cache",  array( $url) );		
    	}
    	
    }

    Hi @rlensen,

    Thanks for choosing WP Cloudflare Super Page Cache!

    We’re glad to hear you managed to solve the issue in the meantime! It would be great if you could mark this thread as resolved.

    Thank you and have a nice day!

    Thread Starter rlensen

    (@rlensen)

    Fixed with the snippet

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

The topic ‘Buddyboss (BBpress) Topic cache purge’ is closed to new replies.