Showing the total number of registered users on your WordPress site is a super easy way to boost social proof and credibility. When potential users see a growing community, they’re more likely to join in.
Unfortunately, WordPress doesn’t offer a beginner-friendly way to show this by default. So, lots of users may miss out on this quick trick for winning new leads.
We wanted to make sure our readers could take advantage of this simple marketing strategy. That’s why we researched and tested several plugins to find the most effective ways to display user count.
We found that using plugins like Simple Blog Stats and WPCode offer the easiest way to show the total number of registered users in WordPress. Keep reading to see our step-by-step guides for both options.
What Are WordPress Users?
Before we dive into our step-by-step guide, let’s talk about what a WordPress user is.
In WordPress, a registered user is anyone who has an account on your site. Upon registration, every WordPress user is assigned a role. Each of these roles has different permissions and abilities, making it easier to manage who can do what on your website.
There are several user roles in WordPress:
- Administrator: Has full control over the site. They can add or delete users, change themes, and install plugins.
- Editor: Can manage and publish posts, including those written by other users.
- Author: Can write and publish their own posts but can’t touch others’ work.
- Contributor: Can write posts but can’t publish them. They need an editor or admin to approve their work.
- Subscriber: Has the least permissions. Subscribers can manage their profiles and read posts.
Keep in mind that the user roles on your site will also depend on the software you are using. For example, when you install WooComerce, the plugin automatically creates a Customer role for your online store.
Why Show the Number of Registered Users in WordPress?
Now, why would you want to display the total number of registered users on your site?
Showing a user count can act as social proof. When visitors see that lots of people have signed up, they may feel more inclined to register themselves. It creates a sense of community and trust.
Plus, displaying this number can help you track your site’s growth over time. It’s a simple way to show that your site is active and engaging.
In the following sections, we will cover 2 methods to show the total number of registered users on your WordPress site. You can use the quick links below to jump to the one you want to use:
Ready? Let’s get started.
Method 1: Show Registered User Count Using a WordPress Plugin
The first thing you need to do is install and activate the Simple Blog Stats plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, you need to visit the Settings » Simple Blog Stats page to configure the plugin settings.
This plugin allows you to show different stats from your WordPress website.
You need to click on the shortcodes tab to expand it and then scroll down to the ‘number of users‘ row.
You will see the shortcode [sbs_users]
with two text fields on both sides. These text fields contain HTML, and the plugin will add before and after the number of users.
By default, the shortcode will output HTML like this:
<span class="sbs-count-users">856</span>
If you are unsure, then copy the shortcode [sbs_users]
and click on the ‘Save Settings’ button.
You can now add this shortcode to any WordPress post or page. You can also add it to a sidebar widget.
Simply edit the post or page and add the ‘Shortcode’ block. After that, you can copy and paste the [sbs_users]
shortcode inside the block settings.
Similarly, you can add the shortcode block in sidebar widgets.
You can just go to the Appearance » Widgets page and add the shortcode block where you want to display the user count.
Method 2: Manually Show The Number of Registered Users in WordPress with Code
This method requires you to add code to your WordPress site. You can add it to your theme’s functions.php
file or by using the WPCode plugin.
We recommend the WPCode method as it’s more beginner-friendly. With WPCode, you don’t have to worry about breaking your site, which will likely happen if you choose to modify your functions.php file.
So, let’s install and activate the WPCode plugin. For step-by-step instructions, you can go through our guide on how to install a WordPress plugin.
Upon activation, you can navigate to Code Snippet » + Add Snippet.
Then, you’ll want to hover over ‘Add Your Custom Code (New Snippet)’ and click the ‘+ Add Custom Snippet’ button when it appears.
On the next screen, WPCode will ask you to choose the code type.
Let’s click on the ‘PHP Snippet’ box.
This will take you to the code editor.
The first thing to do here is to name the custom code snippet. You’ll want to use a clear name so you can easily refer to it later. For example, we named ours ‘Display User Count.’
Then, you can add the following code to the ‘Code Preview’ area.
// Function to return user count
function wpb_user_count() {
$usercount = count_users();
$result = $usercount['total_users'];
return $result;
}
// Creating a shortcode to display user count
add_shortcode('user_count', 'wpb_user_count');
If you need help adding code, then follow our tutorial on how to safely add custom code in WordPress.
Here’s what it looks like on the editor:
Once done, you can toggle the switch from ‘Inactive’ to ‘Active.’
After that, you can go ahead and click the ‘Save Snippet’ button.
This code creates a shortcode [user_count]
you can use in your WordPress posts, pages, or a sidebar widget to display the user count.
Do note that this function doesn’t apply any HTML formatting to the user count; it simply returns the number. As a result, the display may appear a bit out of place since it lacks any context.
So, you may want to wrap the shortcode around HTML to use CSS or basic HTML formatting.
To do this, let’s open a post or page to add the shortcode.
Once you’re in the block editor, you can click the ‘+’ button and choose the ‘Shortcode’ block. Then, you can add the following HTML formatting example:
<p>Join <strong>[user_count]</strong> other users who share your interests:</p>
You can definitely adjust the copy to suit your needs.
Here is how it looked on our demo site:
Note: We also added a free signup button that redirected to a custom WordPress user registration page.
Further Reading: WordPress User Roles
Looking to dive deeper into managing users on your WordPress site? Then you’ll want to check out these helpful resources:
- Free User Management Plugins for WordPress
- Beginner’s Guide to WordPress User Roles and Permissions
- How to Bulk Delete WordPress Users With Specific Roles
We hope this article helped you learn how to show the total number of registered users in WordPress. Next, you may also want to see our guide on how to display recently registered users or moderating new user registrations in WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Godson
Thank a milli for the guide…. Very helpful
WPBeginner Support
Glad our guide was helpful
Admin
papoo
Hello
thanks for manual method, works fine.
is there a way to add user count in wp REST API?
WPBeginner Support
You likely could but we don’t have an article on how to do so at the moment.
Admin
papoo
i found a way
add shortcode on a page, then access on json with
wp-json/wp/v2/pages/?slug=”name of the page”
and… search the info
B
Thanks for the manual code!
Is there any way to display the user count from another Wordpress site? I have a public facing website and private “app” that are two different installs and I want to show the app users on the public site.
Angela
Thanks for this, the code works beautifully!
Chad
Hey, thanks for this article, its right along the lines of what I am trying to accomplish. Is there a way to only display the subscribers as opposed to the total number of users? I have been scouring the wp codex site but to no avail. I have found a way to populate a list of subscribers but not jsut a total number of them. This would be extremely handy on the website I am building I would love to hear your insight. Thanks again.
Matt
This might be helpful for you:
// Function to show the user count by role via shortcode
function wpb_user_count($atts) {
$atts = shortcode_atts( array(
‘role’ => ”
), $atts );
$user_query = new WP_User_Query( array( ‘role’ => $atts[‘role’] ) );
// Get the total number of users for the current query. I use (int) only for sanitize.
$result = (int) $user_query->get_total();
return $result;
}
// Creating a shortcode to display user count
add_shortcode(‘user_count’, ‘wpb_user_count’);
// Use this Shortcode to show user [user_count role=”Subscriber”]
Benedikt
Hey Guys,
found this article and tried both options and both do not work. Usually I am pretty good in this WP stuff …
Could it be that it does not work with certain themes?
It would be great if you could help:
Here is the page:
(We use the Kleo Theme)
Thanks
Benedikt
Benedikt
Hey Guys,
found this article and tried both options and both do not work. Usually I am pretty good in this WP stuff …
It would be great if you could help
Thanks
Benedikt