
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.
19 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.
Thanks for this great tip.
On a related note, is it possible to have something like this to display the number of readers who have subscribed to a blog?
Hi-Do you know of a way to display number of views of a specific page? It seems like such a simple concept yet I cant find how to do this and all the plugins out there want to give you a display of total sitewide views or total pages viewed but I am just after total number of hits for a page that I can specify- Any ideas? Thanks and love your site!
Trackbacks: