Show Total Users In WordPress

Share Now

#Add this code in functions.php file

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

#echo the shortcode to display the data

<?php echo do_shortcode('[user_count]'); ?>
Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert