Created
December 1, 2017 10:48
-
-
Save nikitasinelnikov/63620e08187b6a8a45621cb762e9b1fc to your computer and use it in GitHub Desktop.
Ultimate Member Hide current user profile from Member Directory using Hooks
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
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@nikitasinelnikov
Is there an update to this? Doesn't seem to work any more...