Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikitasinelnikov/63620e08187b6a8a45621cb762e9b1fc to your computer and use it in GitHub Desktop.
Save nikitasinelnikov/63620e08187b6a8a45621cb762e9b1fc to your computer and use it in GitHub Desktop.
Ultimate Member Hide current user profile from Member Directory using Hooks
add_filter( 'um_prepare_user_query_args', 'um_remove_current_user_from_list', 100, 2 );
function um_remove_current_user_from_list( $query_args, $args ) {
if ( is_user_logged_in() ) {
if ( ! empty( $query_args['exclude'] ) )
$query_args['exclude'] = array_merge( $query_args['exclude'], array( get_current_user_id() ) );
else
$query_args['exclude'] = array( get_current_user_id() );
}
return $query_args;
}
@hirenshah
Copy link

@nikitasinelnikov

Is there an update to this? Doesn't seem to work any more...

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