How To Show Total Number of Registered Users in WordPress - WPTRINITY

How To Show Total Number of Registered Users in WordPress

If you want to show total number of registered users on your WordPress site? add this code to your theme’s functions.php file.

// Function to return user count
function wpe_user_count() { 
$usercount = count_users();
$result = $usercount['total_users']; 
return $result; 
} 
// Creating a shortcode to display user count
add_shortcode('total_user_count', 'wpe_user_count');

That code creates a shortcode that allows you to display total number of registered users on your site. Now you just need to add this shortcode to [total_user_count] your post or page where you want to show the total number of users.