bbp_update_topic_voice_count( int $topic_id )
Adjust the total voice count of a topic
Description Description
Parameters Parameters
- $topic_id
-
(Optional) Topic id to update
Return Return
(int) Voice count
Source Source
File: includes/topics/functions.php
function bbp_update_topic_voice_count( $topic_id = 0 ) { // 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 ); // Bail if no topic ID if ( empty( $topic_id ) ) { return; } // Count the engagements $count = count( bbp_get_topic_engagements( $topic_id ) ); // Update the voice count for this topic id update_post_meta( $topic_id, '_bbp_voice_count', $count ); // Filter & return return (int) apply_filters( 'bbp_update_topic_voice_count', $count, $topic_id ); }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | bbPress (r6515) This must be called after any engagement changes |
2.0.0 | Introduced. |