Are you looking for a way to display all subscribers in an unordered list? While there’s probably a plugin for this, we have created a quick code snippet that you can use to display all subscribers in an unordered list in WordPress.
Instructions:
All you have to do is add this code to your theme’s index.php file:
<ul> <?php $blogusers = get_users('blog_id=1&orderby=nicename&role=subscriber'); foreach ($blogusers as $user) { echo '<li>' . $user->display_name . '</li>'; } ?> </ul>
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 10 best WordPress table plugins to organize data and how to create a guest post submission form in WordPress.
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.
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.