Exclude admin from WP_Query Contributors

I realize now that you’re not talking about WP_Query but WP_User_Query. Looking at the documentation for WP_User_Query it says this about the who parameter:

  • who (string) – Which users to query. Currently only ‘authors’ is supported. Default is all users.

Instead you can use the role parameter and exclude certain users by ID like so:

// Grab all contributors
$contributor_ids = new WP_User_Query( array(
    'role'      => 'contributor',
    'exclude'   => array( 10, 18, 4, 15, 9 )
) );

You can also pass multiple roles to the above. For more info check out the section on roles.

tech