• I want to get the users of role academic and student. I have tried using the code below (passing an array of roles, but all users are being displayed, so clearly it’s not working.

    $roles=array('academic','student');
    $args =array('role'=>$roles);
    $users=get_users( $args );
    
    foreach ($users as $user) {
        echo '<li>' . $user->user_email . '</li>';
    }
  • The topic ‘Can I pass two roles to the function get_users?’ is closed to new replies.