WP_User_Query is Not Displaying Results
I'm trying to create a table with a list of users and it only seems to work when I have it set up like this:
$user_report_query = new WP_User_Query( array(
'role' = 'Administrator'
) );
The array I'm trying to use is:
$args = array (
'role' = 'Participant',
'order' = 'ASC',
);
Participant
is a custom role which has already been set up. I can select the role when creating users from the role dropdown menu. But any time i try to edit the query to use the array argument
$user_report_query = new WP_User_Query( $args );
it tells me no users have been found
if ( ! empty( $user_report_query-results ) ) {
//display users
} else {
echo 'No users found.';
}
It only seems to work when I have the role as Administrator. As far as I can tell this is a basic WordPress user query so i shouldn't be having any problems with it. Any idea what it might be?
Topic wp-user-query Wordpress
Category Web