Exclude subscriber users from user list


I want to exclude Subscribers from a user list. My code is:

$users = $wpdb->get_results( "SELECT display_name FROM $wpdb->users ORDER BY display_name ASC" );

How can I change that so subscribers are excluded from the list?

I also looked at the get_users function in codex but it did not have an exclude by role parameter. 

Edit: Or another way would be to get the results filtered by capability (one that subscribers doesn’t have).

, Mark 2 years 2020-01-05T09:42:02-05:00 0 Answers 81 views 0

Leave an answer