Display the total number of users of your WordPress blog

April 27, 2009 at 2:46 pm

If your blog allow user registration, what about displaying the total number of registered users? This simple code will allow you to do it easily.

To achieve this recipe, simply paste the following code anywhere in your theme files:

$users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users");
echo $users." registered users.";

Once you saved the file and refreshed your blog, the total number of users will be displayed.