Last active
June 23, 2021 12:59
-
-
Save wbcomdev/f61d9ed10fda984217edb15dd00f58ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Hide users from BuddyPress members list. | |
| * | |
| * @param array $args Args. | |
| * | |
| * @return array | |
| */ | |
| function wbcom_exclude_members_from_member_directory_page( $args ) { | |
| if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { | |
| return $args; | |
| } | |
| $excluded = isset( $args['exclude'] ) ? $args['exclude'] : array(); | |
| if ( ! is_array( $excluded ) ) { | |
| $excluded = explode( ',', $excluded ); | |
| } | |
| $user_ids = array( 20, 24, 32 ); // user ids to exclude. | |
| $excluded = array_merge( $excluded, $user_ids ); | |
| $args['exclude'] = $excluded; | |
| return $args; | |
| } | |
| add_filter( 'bp_after_has_members_parse_args', 'wbcom_exclude_members_from_member_directory_page' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment