WordPress.org

Ready to get started?Download WordPress

Forums

Possible bug in user count, WordPress Admin (2 posts)

  1. hajejan
    Member
    Posted 3 years ago #

    I've just noticed I'm seeing a strange number in my number of users in /wp-admin/users.php

    It reports I have:

    All (17) | Administrator (16) | Contributor (1)

    but the list only shows 1 contributor and 3 administrators (I created all these user accounts, so there's no security breach there)

    I've checked the database, and there are only 4 users in the [prefix]_users table.

    Where do these numbers come from, and why might they be miscounting?

  2. gab.ro
    Member
    Posted 2 years ago #

    The user count you mention uses a function called count_users, located in wp-includes/user.php.

    If you take a look at the function's code, you'll see some comments there. It says that the function:

    * Assumes there are neither duplicated nor orphaned capabilities meta_values.
    * Assumes role names are unique phrases.

    I would bet that one or more of the mentioned assumptions were not met in you case.

    I also experienced this issue and found it to be caused by the fact that I deleted some users directly from the database, omitting to also delete their meta_values. Orphaned meta_values it's called, apparently.

Topic Closed

This topic has been closed to new replies.

About this Topic