I have seen other blogs show the number of users for their site, but everywhere I looked for instructions, but most of them never told me which file to place it in. I grew tired of running into article on “WordPress Display Users” which only told me how to display the names of users. Finally, I ran across another site that explained to place the code anywhere in your theme files. That can be scarey to some, as you can mess up files by doing like this. However, this code was very safe, as I placed it in my Function theme’s file and it worked! Don’t forget to backup any file you edit, prior to editing! Then you can always reload it if necessary. See instructions below.
WordPress Display Users Amount Instructions
If your wordpress blog allows users to register for your blog, and you wish to display the number of users do the following:
Either by using your control panel or an application such as FileZilla, add the following code at the bottom of your Function file located in your theme’s folder:
$users = $wpdb->get_var(“SELECT COUNT(ID) FROM $wpdb->users”);
echo $users.” registered users.”;
Don’t forget to save the changes!
Then go to the home page of your WordPress blog. You will see the number of users in the top left hand corner. If you were already on your home page, just refresh it.
If you leave the code as is, above ,you will see for example “1024 registered users.” You can change the wording in the code above to something like, “Registered Users for THE NAME OF YOUR BLOG.” Change “THE NAME OF YOUR BLOG” to the actual name of your blog.
Let me know if you have any questions!










