Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:00
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Hide Logged in user on BuddyPress directory
add_filter('bp_ajax_querystring', 'devb_hide_user_on_directory', 15, 2);
function devb_hide_user_on_directory( $query_string, $object ){
if( !is_user_logged_in() )
return $query_string;
if( $object != 'members' || isset( $_REQUEST['search_terms'] ) && $_REQUEST['search_terms'] ) //updated to not hide from sarch
return $query_string;
if( ! bp_is_user() && bp_is_members_component() ){
$args = wp_parse_args( $query_string );
$args['exclude'] = array( 0 => get_current_user_id() );
$query_string = build_query( $args );
return $query_string;
Copy link

In which folder will i applied this file? will it be ok on function.php?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment