BP_REST_Forums_Endpoint::get_sub_forums( array $args )
Get sub forums.
Description
Parameters
- $args
-
(Required) array for the parameters.
Return
(array|void)
Source
File: bp-forums/classes/class-bp-rest-forums-endpoint.php
public function get_sub_forums( $args ) { $sub_forums = bbp_forum_get_subforums( $args ); if ( empty( $sub_forums ) ) { return; } $retval = array(); foreach ( $sub_forums as $sub_forum ) { $retval[] = array( 'id' => $sub_forum->ID, 'slug' => $sub_forum->post_name, 'title' => bbp_get_forum_title( $sub_forum->ID ), 'count' => array( 'topic' => bbp_get_forum_topic_count( $sub_forum->ID ), 'reply' => bbp_get_forum_reply_count( $sub_forum->ID ), ), 'link' => bbp_get_forum_permalink( $sub_forum->ID ), 'group' => ( ( function_exists( 'bbp_is_forum_group_forum' ) && bbp_is_forum_group_forum( $sub_forum->ID ) && function_exists( 'groups_get_group' ) ) ? ( bbp_get_forum_group_ids( $sub_forum->ID ) ? groups_get_group( current( bbp_get_forum_group_ids( $sub_forum->ID ) ) ) : '' ) : '' ), ); } return $retval; }
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.