bbp_update_topic_reply_count_hidden( int $topic_id, int $reply_count = false )

Adjust the total hidden reply count of a topic (hidden includes trashed, spammed and pending replies)


Description Description


Parameters Parameters

$topic_id

(Optional) Topic id to update

$reply_count

(Optional) Set the reply count manually

Default value: false


Top ↑

Return Return

(int) Topic hidden reply count


Top ↑

Source Source

File: includes/topics/functions.php

function bbp_update_topic_reply_count_hidden( $topic_id = 0, $reply_count = false ) {

	// If it's a reply, then get the parent (topic id)
	$topic_id = bbp_is_reply( $topic_id )
		? bbp_get_reply_topic_id( $topic_id )
		: bbp_get_topic_id( $topic_id );

	// Get replies of topic
	$reply_count = ! is_int( $reply_count )
		? bbp_get_non_public_child_count( $topic_id, bbp_get_reply_post_type() )
		: (int) $reply_count;

	update_post_meta( $topic_id, '_bbp_reply_count_hidden', $reply_count );

	// Filter & return
	return (int) apply_filters( 'bbp_update_topic_reply_count_hidden', $reply_count, $topic_id );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.