bbp_bump_topic_reply_count( int $topic_id, int $difference = 1 )
Bump the total reply count of a topic
Description Description
Parameters Parameters
- $topic_id
-
(Optional) Topic id.
- $difference
-
(Optional) Default 1
Default value: 1
Return Return
(int) Topic reply count
Source Source
File: includes/topics/functions.php
function bbp_bump_topic_reply_count( $topic_id = 0, $difference = 1 ) {
// Bail if no bump
if ( empty( $difference ) ) {
return false;
}
// Get counts
$topic_id = bbp_get_topic_id( $topic_id );
$reply_count = bbp_get_topic_reply_count( $topic_id, true );
$difference = (int) $difference;
$new_count = (int) ( $reply_count + $difference );
// Update this topic id's reply count
update_post_meta( $topic_id, '_bbp_reply_count', $new_count );
// Filter & return
return (int) apply_filters( 'bbp_bump_topic_reply_count', $new_count, $topic_id, $difference );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |