bbp_bump_topic_reply_count( int $topic_id, int $difference = 1 )
Bump the total reply count of a topic
Description
Parameters
- $topic_id
-
(Optional) Forum id.
- $difference
-
(Optional) Default 1
Default value: 1
- $update_ancestors
-
(Optional) Default true
Return
(int) Forum reply count
Source
File: bp-forums/topics/functions.php
function bbp_bump_topic_reply_count( $topic_id = 0, $difference = 1 ) {
// Get counts
$topic_id = bbp_get_topic_id( $topic_id );
$reply_count = bbp_get_topic_reply_count( $topic_id, true );
$new_count = (int) $reply_count + (int) $difference;
// Update this topic id's reply count
update_post_meta( $topic_id, '_bbp_reply_count', (int) $new_count );
return (int) apply_filters( 'bbp_bump_topic_reply_count', (int) $new_count, $topic_id, (int) $difference );
}
Changelog
| Version | Description |
|---|---|
| bbPress (r3825) | 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.