How to modify the number of replies in bbPress

bbPress the number of Replies

In bbPress, a WordPress plugin, the number of posts is displayed instead of that of replies. To display the actual number of replies, we need to subtract "1" from the number of posts. To do this, please add the following function to your theme function file (functions.php):

function bbp_get_topic_post_count_modified( $replies, $topic_id ) {
        $topic_id = bbp_get_topic_id( $topic_id );
        $replies  = (int) get_post_meta( $topic_id, '_bbp_reply_count', true );
        
        return $replies;
    }
add_filter( 'bbp_get_topic_post_count', 'bbp_get_topic_post_count_modified', 10, 2 );

bbPress Replies count corrected
Now the number of replies is displayed instead of the that of posts in bbPress. (Note: You can download a table-style bbPress template at this post.)


Leave a Comment