bp_groups_get_group_types( array|string $args = array(), string $output = 'names', string $operator = 'and' )
Get a list of all registered group type objects.
Description
See also
- bp_groups_register_group_type(): for accepted arguments.
Parameters
- $args
-
(Optional) An array of key => value arguments to match against the group type objects.
Default value: array()
- $output
-
(Optional) The type of output to return. Accepts 'names' or 'objects'. Default 'names'.
Default value: 'names'
- $operator
-
(Optional) The logical operation to perform. 'or' means only one element from the array needs to match; 'and' means all elements must match. Accepts 'or' or 'and'. Default 'and'.
Default value: 'and'
Return
(array) $types A list of groups type names or objects.
Source
File: bp-groups/bp-groups-functions.php
2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 | function bp_groups_get_group_types( $args = array (), $output = 'names' , $operator = 'and' ) { $types = buddypress()->groups->types; $types = wp_filter_object_list( $types , $args , $operator ); /** * Filters the array of group type objects. * * This filter is run before the $output filter has been applied, so that * filtering functions have access to the entire group type objects. * * @since BuddyPress 2.6.0 * * @param array $types group type objects, keyed by name. * @param array $args Array of key=>value arguments for filtering. * @param string $operator 'or' to match any of $args, 'and' to require all. */ $types = apply_filters( 'bp_groups_get_group_types' , $types , $args , $operator ); if ( 'names' === $output ) { $types = wp_list_pluck( $types , 'name' ); } return $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.