X

Add total members to “Right Now” dashboard widget

MailPoet Newsletters Review - create signup forms

Great little snippet that will display the total number of members within the Right now dashboard widget. Just add this to the functions.php of your wordpress theme and you are ready to go.


( example screenshot )

Code Snippet:


function dashboard_wps_user_count() {
global $wpdb;
$users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users");
?>
<table>
<tbody>
<tr class="first">
<td class="first b b_pages"><a href="users.php"><? echo $users; ?></a></td>
<td class="t pages"><a href="users.php">Members</a></td>
</tr>
</tbody>
</table>
<?}
add_action( 'right_now_content_table_end', 'dashboard_wps_user_count');

Comments  Leave a Reply

  1. Hi Kein, Happy to land here!! 🙂
    Thanks for this great snipp!
    Is it possible to add custom post type count also? 🙂

  2. This seems to have a number of issues Kevin. For those that may not know the <?} will throw an error. Also, "Members" on the dashboard doesn't show a count.

    1. What issues are you having with the snippet?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!