WordPress.org

Support

Support » How-To and Troubleshooting » get_users does not work for roles

get_users does not work for roles

  • dejudicibus
    Participant

    @dejudicibus

    If I use get_users to return only the ‘authors’ by using the following code:

    $user_options = array(
      'orderby' => 'display_name',
      'order'   => 'ASC',
      'role'    => 'author',
      'who'     => 'authors'
    );
    $all_authors = get_users($users_options);
    foreach ($all_authors as $author) {
     if ($author->ID > 1) {
       /* do something */
     }
    }

    I get back all users but admin, that is, also subscribers.

  • The topic ‘get_users does not work for roles’ is closed to new replies.