How to Show Total Number of Registered Users in WordPress212

How to Show Total Number of Registered Users in WordPress
Author: InfoBeep - September 19, 2017 | subject to copyright

The more you have the number of registered users, the more you encourage non-registered users to get registered. In this article, we are going to guide you through two different methods to show registered user count using a WordPress plugin.

Method 1: Show registered user count using a WordPress plugin

In order to show registered user count using a WordPress plugin, follow the steps below:

  • Install and activate ‘Simple Blog Stats’ plugin.
  • Go to Setting > Simple Blog Stats to configure setting, you should be able to see the page as shown in picture below:

simple-blog-state

  • Now, click on Shortcodes tab to expand. Here, you will see shortcut code for different things which you can include on your website. Here, we are searching for shortcode to show the number of registered users. Search for ‘number of users’ as shown in the picture below:
  • By default, the shortcode should be:

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

  • If unsure, just copy the code [sbs_users]

Method 2: Manually show number of registered users in WordPress with code:

In this method, we will use code instead of plugin. Now, you may follow the steps below:

  • Add the code below in your theme’s function.php file or 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');
  • This code above creates shortcode [user_count].
  • Now, you can use the code as given below: (Demo picture given below)

Join &amp;amp;amp;lt;strong&amp;amp;amp;gt;[user_count]&amp;amp;amp;lt;/strong&amp;amp;amp;gt; other users who share your interest:

join us