bbp_get_forum_ancestors( int $forum_id )
Return array of parent forums
Description
Parameters
- $forum_id
-
(Optional) Forum id
Return
(array) Forum ancestors
Source
File: bp-forums/forums/template.php
704 705 706 707 708 709 710 711 712 713 714 715 716 717 | function bbp_get_forum_ancestors( $forum_id = 0 ) { $forum_id = bbp_get_forum_id( $forum_id ); $ancestors = array (); $forum = bbp_get_forum( $forum_id ); if ( ! empty ( $forum ) ) { while ( 0 !== (int) $forum ->post_parent ) { $ancestors [] = $forum ->post_parent; $forum = bbp_get_forum( $forum ->post_parent ); } } return apply_filters( 'bbp_get_forum_ancestors' , $ancestors , $forum_id ); } |
Changelog
Version | Description |
---|---|
bbPress (r2625) | 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.