Function: wp_get_users_with_no_role

wp_get_users_with_no_role( integer | null $site_id )

Get the user IDs of all users with no role on this site.

Parameters

Name Type(s) Default Value Description
$site_id integer | null null

Optional. The site ID to get users with no role for. Defaults to the current site.

Returns

array

Array of user IDs.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.