Title: Directory &#8211; Excluding Users
Last modified: March 27, 2020

---

# Directory – Excluding Users

 *  [hshah](https://wordpress.org/support/users/hshah/)
 * (@hshah)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/directory-excluding-users/)
 * I don’t believe the previous filters work any more, so how does one go about 
   completely excluding the current user from the directory?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Contributor [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/directory-excluding-users/#post-12595417)
 * Hi [@hshah](https://wordpress.org/support/users/hshah/)
 * You can still use this filter hook to exclude a specific user from the User Query:
 * `um_prepare_user_query_args`
 *     ```
       add_filter("um_prepare_user_query_args","um_custom_exclude_current_user", 10, 1 );
       function um_custom_exclude_current_user( $args ){
             $args['exclude'] = array( 123, 333, 99, 5 ); // exclude users by user ID
        return $args;
       }
       ```
   
 * Regards,
 *  Thread Starter [hshah](https://wordpress.org/support/users/hshah/)
 * (@hshah)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/directory-excluding-users/#post-12595455)
 * [@champsupertramp](https://wordpress.org/support/users/champsupertramp/)
 * I have tried that and numerous other things before creating this thread.
 * Just to reconfirm, I just put what you posted into my functions.php and added
   some error_log lines so that I could see what was going on when I loaded the 
   members directory page. This is on a staging site so all caching etc is disabled.
 * The log file was empty… the function wasn’t even invoked.
 * /Edit: Even tried a search and still it was empty. Just to make sure the logging
   wasn’t broken in any way, I intentionally broke the function, and that wrote 
   to the log file.
 * Others have mentioned that this stopped working when the directory was updated
   to use ajax etc. I can definitely tell you it doesn’t work lol!
    -  This reply was modified 6 years, 2 months ago by [hshah](https://wordpress.org/support/users/hshah/).
 *  Thread Starter [hshah](https://wordpress.org/support/users/hshah/)
 * (@hshah)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/directory-excluding-users/#post-12639642)
 * [@champsupertramp](https://wordpress.org/support/users/champsupertramp/)
 * Any comment with something that actually works?
 *  Thread Starter [hshah](https://wordpress.org/support/users/hshah/)
 * (@hshah)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/directory-excluding-users/#post-12664347)
 * [@champsupertramp](https://wordpress.org/support/users/champsupertramp/)
 * Anyone around? lol 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Directory – Excluding Users’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [hshah](https://wordpress.org/support/users/hshah/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/directory-excluding-users/#post-12664347)
 * Status: not resolved