Display the total number of users of your WordPress blog

By | May 14, 2009

wordpress-logoPro Blog Tutorials has again brought to us another very useful and practical tutorial in the WordPress realm. With this simple code and WordPress hack, you will be able to show the total number of  users for your WordPress blog, anywhere you want in your template.

Just place the following code anywhere in your template for the number of registered users on your WordPress blog to be shown:

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