bp_groups_has_group_type( int $group_id, string $group_type )
Check whether the given group has a certain group type.
Description
Parameters
- $group_id
-
(Required) ID of the group.
- $group_type
-
(Required) Group type.
Return
(bool) Whether the group has the give group type.
Source
File: bp-groups/bp-groups-functions.php
function bp_groups_has_group_type( $group_id, $group_type ) { if ( empty( $group_type ) || ! bp_groups_get_group_type_object( $group_type ) ) { return false; } // Get all group's group types. $types = bp_groups_get_group_type( $group_id, false ); if ( ! is_array( $types ) ) { return false; } return in_array( $group_type, $types ); }
Changelog
Version | Description |
---|---|
BuddyPress 2.6.0 | 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.