WordPress.org

Ready to get started?Download WordPress

Forums

get_users does not work for roles (1 post)

  1. dejudicibus
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags