Home / members / Display all subscribers in an unordered list
  • How to Display all subscribers in an unordered list

    display-all-subscribers-in-an-unordered-list

    Adding this snippet to your wordpress theme will display all subscribers in an unordered list

    wordpress snippet : PHP

    <>
    <ul>
    <?php
        $blogusers = get_users('blog_id=1&orderby=nicename&role=subscriber');
        foreach ($blogusers as $user) {
            echo '<li>' . $user->display_name . '</li>';
        }
    ?>
    </ul>
    

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

    get_users, _n,
  • jeffikus

    That’s not a very scalable solution unfortunately. You need to add pagination into it as well as the ‘number’ and ‘offset’ parameters to handle it. From my testing, the get_users() function does not handle well when you have more than approx 1000 results in the query.

    • http://wpsnipp.com Kevin Chard

      I have not tested this snippet with over 1000 subscribers myself so I have to trust you on this one. Without pagination this would be a solution for smaller websites, if you have another solution please feel free to contribute I would be happy to post the solution.