bp_groups_exclude_group_type( bool $qs = false, bool $object = false )
Excludes specific group types from search and listing.
Description
Parameters
- $qs
-
(Optional)
Default value: false
- $object
-
(Optional)
Default value: false
Return
(bool|string)
Source
File: bp-groups/bp-groups-functions.php
3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 | function bp_groups_exclude_group_type( $qs = false, $object = false ) { $args = wp_parse_args( $qs ); if ( $object !== 'groups' ) { return $qs ; } if ( bp_is_groups_directory() && isset( $args [ 'scope' ] ) && 'all' === $args [ 'scope' ] ) { // get removed group type post ids $bp_group_type_ids = bp_groups_get_excluded_group_types(); // get removed group type names/slugs $bp_group_type_names = array (); if ( isset( $bp_group_type_ids ) && ! empty ( $bp_group_type_ids ) ) { foreach ( $bp_group_type_ids as $single ) { $bp_group_type_names [] = $single [ 'name' ]; } } if ( ! empty ( $args [ 'group_type__not_in' ] ) ) { if ( is_array ( $args [ 'group_type__not_in' ] ) ) { $args [ 'group_type__not_in' ] = array_merge ( $args [ 'group_type__not_in' ], $bp_group_type_names ); } else { $args [ 'group_type__not_in' ] = $args [ 'group_type__not_in' ] . ',' . implode( ',' , $bp_group_type_names ); } } else { $args [ 'group_type__not_in' ] = implode( ',' , $bp_group_type_names ); } $qs = build_query( $args ); } return $qs ; } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.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.