Can I pass two roles to the function get_users? (1 post)

  1. nicolaelvin
    Posted 3 years ago #

    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.

    $args =array('role'=>$roles);
    $users=get_users( $args );
    foreach ($users as $user) {
        echo '<li>' . $user->user_email . '</li>';

Topic Closed

This topic has been closed to new replies.

About this Topic