Im trying to create a user directory on the front end of my site so to display all of the users and also allow for them to search and filter to find a specific member. Below is my user query which works fine:


$args = array(
  'number'         => '12',
  'order'          => 'ASC',
  'orderby'        => 'id',

$user_query = new WP_User_Query( $args );

if ( ! empty( $user_query->results ) ) {
  foreach ( $user_query->results as $user ) { ?>

    <li class="list-group-item">
      // User information here
  <?php }
} else { ?>
  // no users found
<?php } ?>

I have then created a custom taxonomy for users using this plugin: which then gives allows you to register a custom tax as you would usually (without the plugin you are usually not able to attach a custom tax to users).

I then want to add a dropdown filter for that custom taxonomy’s terms to allow to filter and only show users who have that specific term. I have dont something like the below in the past which when i add, it displays all my taxonomy terms, but im not sure how to get that to update my query?

<?php $categories = get_terms('category');?>
        <?php if( !empty($categories)) : ?>
             <select class="form-control">
                  <?php foreach ($categories as $category) : ?>
                    <option value="<?php echo $category->slug;?>"><?php echo $category->name;?></option>
                  <?php endforeach; ?>
        <?php endif;?>

Read more here: Querying Users/Authors and adding taxonomy filter


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: