Title: List authors by posts?
Last modified: August 19, 2016

---

# List authors by posts?

 *  [c](https://wordpress.org/support/users/igneous/)
 * (@igneous)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/list-authors-by-posts/)
 * I want to list authors by the amount of posts they made, is this possible? I 
   couldnt see a way to do it in the docs

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

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/list-authors-by-posts/#post-1053880)
 * Don’t know how efficient this is:
 *     ```
       <?php
       //Get users and count of posts put into array $uc, sort array by post count descending, loop through array and echo user info
       $uc=array();
       $blogusers = get_users_of_blog();
       if ($blogusers) {
         foreach ($blogusers as $bloguser) {
           $post_count = get_usernumposts($bloguser->user_id);
           $uc[$bloguser->user_id]=$post_count;
         }
         arsort($uc); //use asort($uc) if ascending by post count is desired
         foreach ($uc as $key => $value) {
           $user = get_userdata($key);
           $author_posts_url = get_author_posts_url($key);
           $post_count = $value;
           echo 'User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' . $user->user_lastname . ' number of posts:' . $post_count . ' author posts url:' . $author_posts_url .'';
         }
       }
       ?>
       ```
   
 * [Edit – note that it is descending using arsort]
 *  Thread Starter [c](https://wordpress.org/support/users/igneous/)
 * (@igneous)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/list-authors-by-posts/#post-1054154)
 * couldnt get that to work, does anyone else have any other thoughts?
 *  [mpiftex](https://wordpress.org/support/users/mpiftex/)
 * (@mpiftex)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/list-authors-by-posts/#post-1054155)
 * **MichaelH** you’re a life saver!! The code above works GREAT!! I’ve been searching
   for a way to do this for hours. Have you figured out by any chance if the code
   is efficient? Are there many db queries taking place? (I have no idea, just asking).
   Again, many thanks.
 * **igneous**, give it another try. Just copy paste it into your code and then 
   change the echo line to show the user info! You can use [this list](http://codex.wordpress.org/Function_Reference/get_userdata )
   to get the user information (name, url, etc) you need.
 *  [djdiego88](https://wordpress.org/support/users/djdiego88/)
 * (@djdiego88)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/list-authors-by-posts/#post-1054174)
 * Hi MichaelH
    Forgive my English The code works for me, but I need only show 10
   or 15 authors by the amount of post they made. How can I restrict that the code
   only show me 10 or 15 authors ordered by $post_count?
 * Thanks
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/list-authors-by-posts/#post-1054175)
 * Looks ok to me..
    Average time, 100 iterations (just to benchmark)..
 *     ```
       0.00684
       ```
   

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

The topic ‘List authors by posts?’ is closed to new replies.

## Tags

 * [meh_code](https://wordpress.org/support/topic-tag/meh_code/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 5 participants
 * Last reply from: [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/list-authors-by-posts/#post-1054175)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
