I want to list in a drop-down box all users who have role "author"

How can i do it?

Thank you

3 Answers 3


you can create a function which gives you all users which have role author in a drop down list.

Note: It is a dummy example modify it as you want( put this function in functions.php or custom plugin ).

Use: Call this function any where in theme like <?php ravs_author_dropdown_list(); ?>

function ravs_author_dropdown_list() {
    // query array
    $args = array(
        'role' => 'author'
    $users = get_users($args);
    if( empty($users) )
    foreach( $users as $user ){
        echo '<option value="'.$user->data->user_login.'">'.$user->data->display_name.'</option>';
  • I am noticing in the admin area when adding such dropdowns to filter users in media, posts or any CPT... WP_User_Query fails once you do a search and the dropdown does not re-appear. I have tried, a similar method above. 'wp_dropdown_users' and directly calling "$user_search = new WP_User_Query('role=subscriber');". I get no results at all once it lands on the search results page. Jan 21, 2019 at 23:02

For posterity, adding a response since as the accepted answer uses a custom method yet WordPress supports this in the wp_dropdown_users method:


 wp_dropdown_users(['who' => 'authors']);

To query other roles [though not asked for in this question], you can use the role parameter, introduced in WordPress 4.7.0:

 wp_dropdown_users(['role' => 'authors']);

More here: https://developer.wordpress.org/reference/functions/wp_dropdown_users/


Use WordPress' built-in wp_dropdown_users with an advanced query as discussed in https://stackoverflow.com/questions/34142789/change-wp-dropdown-users-filter-by-user-role

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.