Hide Admin Users from the Members Directory
SeeKo: Hide Admin Users from the Members DirectoryFor any theme using buddy press you will realize it has a members directory page. As an admin user you can hide your profile from other members in the seeko theme.
The Seeko theme is normally bundled with one already customizable child theme.you can simply edit the funtions.php file to add the code below or else, If you’re using this child theme and you don’t want to change existing files for fear of missing the customization options in an upcoming update, we suggest adding snippets to the WordPress admin section with the Code Snippets plugin.
When the plugin has been enabled and activated, just visit Snippets > > Add New. Label the snippet and type or insert the code below.
In Most cases, you would just have to run this code snippet while browsing your website content. Simply choose the “Only run on site front-end” method and tap the “Save Changes and Activate” button. In case you are not sure or if you have a problem with your snippet, you can simply leave as the default “Run snippets everywhere” option.
// Remove admins from the members directoryfunction seeko_hide_admins_from_directory( $qs = false, $object = false ) { $excluded_user = implode( ',', get_users( 'role=administrator&fields=ID' ) ); if ( $object != 'members' && $object != 'friends' ) { // hide admins in members and friends lists return $qs; } $args = wp_parse_args( $qs ); if ( ! empty( $args['user_id'] ) ) { return $qs; } if ( ! empty( $args['exclude'] ) ) { $args['exclude'] = $args['exclude'] . ',' . $excluded_user; } else { $args['exclude'] = $excluded_user; } $qs = build_query( $args ); return $qs;}add_action( 'bp_ajax_querystring', 'seeko_hide_admins_from_directory', 20, 2 );