• Hi

    I have created Pro role for a WooCommerce all was Ok but since a few month I can not arrive the number of users in each role ?

    Another problem, some users – 5 are waiting for activation but in fact they are more than 5 users maybe 20 users or more

    Thanks for your help. I precise I also use WP-Members

    Best

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Vladimir Garagulya

    (@shinephp)

    WordPress users page by default splits users view by user roles and includes users quantity to which role is granted. WordPress uses the count_users() function for this purpose.
    https://developer.www.ads-software.com/reference/functions/count_users/

    This function is time and/or memory critical. WordPress limited such calculations by users quantity 10000 by default.

       $count_users = ! wp_is_large_user_count();
        if ( $count_users ) {
             $users_of_blog = count_users();
        }
    /**
    	 * Filters whether the site is considered large, based on its number of users.
    	 *
    	 * @since 6.0.0
    	 *
    	 * @param bool     $is_large_user_count Whether the site has a large number of users.
    	 * @param int      $count               The total number of users.
    	 * @param int|null $network_id          ID of the network. null represents the current network.
    	 */
    	return apply_filters( 'wp_is_large_user_count', $count > 10000, $count, $network_id );

    If it’s your case and such calculation is critical for your in opposite to the users page load time, you may increase this value via wp_is_large_user_count filter.

    Thread Starter Sandra Boulou

    (@debby78018)

    Hi,

    Thanks a lot for your feed back I have a lot of users… so I am not sure to understand, I have to insert your snipet in my functions.php ?

    Thread Starter Sandra Boulou

    (@debby78018)

    I have maybe 2000 or 3000 users I think

    Plugin Author Vladimir Garagulya

    (@shinephp)

    2000-3000 users should be processed as expected by default. WP stops count users by roles when users > 10000.

    May be some plugin changes this behavior. Try deactivate plugins (may be at the stage copy) and look on the Users page. If it will start count users by roles, activate plugins back one by one with a new test to isolate a reason.

    Thread Starter Sandra Boulou

    (@debby78018)

    OK thanks a lot !! I will check… best regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘number of users in specific role’ is closed to new replies.