bbp_get_reply_ancestor_id( in $reply_id )
Return the reply’s ancestor reply id
Description
Parameters
- $reply_id
-
(Required) Reply id
Source
File: bp-forums/replies/template.php
function bbp_get_reply_ancestor_id( $reply_id = 0 ) { // Validation $reply_id = bbp_get_reply_id( $reply_id ); if ( empty( $reply_id ) ) return false; // Find highest reply ancestor $ancestor_id = $reply_id; while ( $parent_id = bbp_get_reply_to( $ancestor_id ) ) { if ( empty( $parent_id ) || ( $parent_id === $ancestor_id ) || ( bbp_get_reply_topic_id( $reply_id ) === $parent_id ) || ( $parent_id === $reply_id ) ) { break; } $ancestor_id = $parent_id; } return (int) $ancestor_id; }
Changelog
Version | Description |
---|---|
bbPress (r4944) | 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.