bbp_update_reply_forum_id( int $reply_id, int $forum_id )
Update the reply with its forum id it is in
Description Description
Parameters Parameters
- $reply_id
-
(Optional) Reply id to update
- $forum_id
-
(Optional) Forum id
Return Return
(bool) The forum id of the reply
Source Source
File: includes/replies/functions.php
function bbp_update_reply_forum_id( $reply_id = 0, $forum_id = 0 ) { // Validation $reply_id = bbp_get_reply_id( $reply_id ); $forum_id = bbp_get_forum_id( $forum_id ); // If no forum_id was passed, walk up ancestors and look for forum type if ( empty( $forum_id ) ) { // Get ancestors $ancestors = get_post_ancestors( $reply_id ); // Loop through ancestors if ( ! empty( $ancestors ) ) { foreach ( $ancestors as $ancestor ) { // Get first parent that is a forum if ( get_post_field( 'post_type', $ancestor ) === bbp_get_forum_post_type() ) { $forum_id = $ancestor; // Found a forum, so exit the loop and continue continue; } } } } // Update the forum ID $retval = bbp_update_forum_id( $reply_id, $forum_id ); // Filter & return return (int) apply_filters( 'bbp_update_reply_forum_id', $retval, $reply_id, $forum_id ); }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |