
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.

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.
17 Responses
Cool! And how many total users wprecipes.com have?
@Alex Vorn: Currently, 595 members
So easy? Thanks a lot
Another useful tip for those that like statistics and have big user database
Great informations.Thanks for sharing.
nice one..thanks
Wow, so very simple!
Thanks mate, Off to try this one out now!
very cool. once i get a “worthy” number of users i will expose the count!
I assume this is for the registered users, not the subscribers like via Feedburner
Slick. As soon as I get enough users to be proud of it, I’ll have to try this one. Good PR starts in your own blog!!!
Great tip. I’d only try to be a little careful with using it just after starting your userbase. Because “we have 4 registered users” is just sad.
Very Useful. Thanks a lot.
Brilliant stuff! This was just what I was looking for. I was doing a search for counting in sql and stumbled across this. Thank you for your help.
Trackbacks: