Javascript,Nodejs,MongodDB,WordPress,CSS,PHP

LightBlog

Tuesday, August 21, 2018

How to Show Total Number of Registered Users in WordPress

Do you want to show total number of registered users on your WordPress site? Simply add this code to your theme’s functions file.here is code:

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

No comments:

Post a Comment