bbp_get_topic_post_count( int $topic_id, boolean $integer = false )

Return total post count of a topic

Description

Parameters

$topic_id

(Optional) Topic id

$integer

(Optional) Whether or not to format the result

Default value: false

Return

(int) Post count

Source

File: bp-forums/topics/template.php

2262
2263
2264
2265
2266
2267
2268
function bbp_get_topic_post_count( $topic_id = 0, $integer = false ) {
    $topic_id = bbp_get_topic_id( $topic_id );
    $replies  = (int) get_post_meta( $topic_id, '_bbp_reply_count', true ) + 1;
    $filter   = ( true === $integer ) ? 'bbp_get_topic_post_count_int' : 'bbp_get_topic_post_count';
 
    return apply_filters( $filter, $replies, $topic_id );
}

Changelog

Changelog
Version Description
bbPress (r2954) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.