WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My blog have many author. I can list all author.

All Author list:

<?php wp_list_authors('exclude_admin=0&optioncount=1&show_fullname=1&hide_empty=1'); ?>

But I want to sort in a special way.

For Example im currently viewing Tech category page, I want a list of author with these id (3,10,12). I will use this code in sidebar widget. And i need a metabox for select author id.


share|improve this question
up vote 0 down vote accepted

I assume that you would be providing the author IDs in the widget options. And that the authors would be displayed in the order they were listed.

Assuming the input would be -> 3,10,12

You can have the following code to display the authors with that user ID in that order:

$user_ids = "3,10,12"; //this is assuming you already have the value stored in a variable

//convert the comma separated string into an array
$user_ids_array = explode(",", $user_ids);

//display the list of users
echo '<ul>';
foreach( $user_ids_array as $id ):
    $user = get_userdata( $id );
    echo '<li>'.$user->ID.' '.$user->display_name.'</li>';
echo '</ul>';
share|improve this answer
Thanx, its worked but i have a question again, how can i list it with author avatar? – Genxer Jan 17 '13 at 17:58
You already have the user ID. Check out this function codex.wordpress.org/Function_Reference/get_avatar – WP Themes Jan 22 '13 at 19:54

You can use the following:

    // prepare arguments
    $args  = array(
    // search only for Authors role
    'role' => 'Author',
    // order results by display_name
    'orderby' => 'display_name'

//add your custom meta key query here

    // Create the WP_User_Query object
    $wp_user_query = new WP_User_Query($args);
    // Get the results
    $authors = $wp_user_query->get_results();
    // Check for results
    if (!empty($authors))
        echo '<ul>';
        // loop trough each author
        foreach ($authors as $author)
            // get all the user's data
            $author_info = get_userdata($author->ID);
            echo '<li>'.$author->ID.' '.$author_info->first_name.' '.$author_info->last_name.'</li>';
        echo '</ul>';
    } else {
        echo 'No authors found';

For more reference see this.

share|improve this answer
Hello, thnx for answer but i need custom solution. i don't know very good PHP. – Genxer Jan 17 '13 at 11:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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