How to Display the Total Number of Registered Users in WordPress Website

Showing the total number of registered users in your WordPress can prompt others to register as well. Below, we outline how to show the total number of your registered WordPress users.

Method 1: Using a WordPress plugin

1. Install and activate the Simple Blog Stats plugin.

2. After the activation, go to the Settings >> Simple Blog Stats to configure your plugin settings. The plugin will display different kinds of statistics of your WordPress site.

3. Click on the Shortcodes tab to expand it.

4. Scroll down to the ‘number of users’ row. The shortcode [sbs_users] appears on the list. It has two text fields on both sides. They contain the HTML code that the plugin adds before and after the user count.

The default value for the shortcode output in HTML format is:

<span class="sbs-count-users">856</span>

5. If you are not sure, copy the shortcode [sbs_users] and click on Save Settings.

6. Add the shortcode to the desired WordPress post or page. You can also add the shortcode to a sidebar widget.  

The shortcode displays the total number of registered users in the desired location. If the shortcode does not work in the widget, follow the step by step guide on how to use shortcodes in your WordPress sidebar widget.

Method 2: Using WordPress code

1. Add the following code to your theme’s functions.php file or a site-specific plugin.

// 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');

The code creates a shortcode [user_count].

  1. Add the shortcode to the desired WordPress post or page. You can also add the shortcode to a sidebar widget to display the user count.  
  2. This shortcode does not add any HTML formatting to the user count and simply displays the total number. To use basic CSS or HTML formatting, you can wrap the shortcode around HTML.

For example:

<p>Join <strong>[user_count]</strong> other users who share your interest:</p>

The output appears as follows:

Note:
In the screenshot above, a free signup button was added that redirects to a user registration page.

 

For further questions, or if you need help, please open a support ticket from your HostPapa Dashboard. Click here to learn how to do it.

 

María is an enthusiast of cinema, literature and digital communication. As Content Coordinator at HostPapa, she focuses on the publication of content for the blog and social networks, organizing the translations, as well as writing and editing articles for the KB.

Was this article helpful?

  • Was this article helpful ?

  • yes   no

Related Articles

Leave A Comment?