bbp_get_forum_reply_count( int $forum_id, bool $total_count = true, boolean $integer = false )

Return total post count of a forum

Description

Parameters

$forum_id

(int) (Optional) Forum id

$total_count

(bool) (Optional) To get the total count or normal count?

Default value: true

$integer

(boolean) (Optional) Whether or not to format the result

Default value: false

Return

(int) Forum reply count

Source

File: bp-forums/forums/template.php

	function bbp_get_forum_reply_count( $forum_id = 0, $total_count = true, $integer = false ) {
		$forum_id = bbp_get_forum_id( $forum_id );
		$meta_key = empty( $total_count ) ? '_bbp_reply_count' : '_bbp_total_reply_count';
		$replies  = (int) get_post_meta( $forum_id, $meta_key, true );
		$filter   = ( true === $integer ) ? 'bbp_get_forum_reply_count_int' : 'bbp_get_forum_reply_count';

		return apply_filters( $filter, $replies, $forum_id );
	}

Changelog

Changelog
Version Description
bbPress (r2464) 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.