I am trying to fetch all users with a specific role eg blogger
and blogger_pro
but my code just returns all users rather than those with that specific role. Hope someone can tell me whats wrong?
The above roles have been added using the plugin User Role Editor
Function:
function get_role_specific_users($role){
$args = array(
'role' => $role,
'orderby' => 'user_nicename',
'order' => 'ASC'
);
return get_users( $args );
}
And then calling it like this:
$pro_authors = get_role_specific_users('blogger_pro');
$authors = get_role_specific_users('blogger');
But both arrays just contains all users rather than those with that role :/