Home / author / List top 5 authors by number of posts
  • How to List top 5 authors by number of posts

    list-top-5-authors-by-number-of-posts

    Adding this snippet to your wordpress theme will list the top five authors in order by the number of posts.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    <?php foreach ( get_users('order=DESC&orderby=post_count&number=5') as $user ) : ?>
        <?php echo $user->display_name; ?> (<?php echo $user->post_count; ?> Posts)
    <?php endforeach; ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    get_users, _n,
  • great .. but didn’t work ..

  • Antoha Thething

    ┬áIt works, but $user->post_count returns nothing…instead of $user->post_count you should use echo count_user_posts( $user->ID ) to display author’s posts count