BP_REST_Groups_Types_Endpoint::bp_rest_group_type_post_by_type( string $group_type )
Get group type post by Group type slug.
Description
Parameters
- $group_type
-
(Required) Group type name.
Return
(array)
Source
File: bp-groups/classes/class-bp-rest-groups-types-endpoint.php
protected function bp_rest_group_type_post_by_type( $group_type ) {
if ( empty( $group_type ) ) {
return;
}
$post_id = '';
$group_type_posts = get_posts(
array(
'name' => $group_type,
'post_type' => 'bp-group-type',
'post_status' => 'publish',
'numberposts' => 1,
'fields' => 'ids',
)
);
if ( ! empty( $group_type_posts ) ) {
$post_id = $group_type_posts[0];
}
return apply_filters( 'bp_member_type_post_by_type', $post_id );
}
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.