How to Show Total Number of Registered Users in WordPress


Here is the simple steps:

add the below code in your functions.php file

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

Add the below shortcode in your theme files or required places


In the above code editor shortcode, if you have been using  single.php or relevant php file use below code

<?php echo do_shortcode( '[user_count]' ); ?>

Related Post

Latest Post

Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.