I am writing a widget in which the user will be able to select the author in radio and the avatar of the admin and description will be displayed in the widget.

wp_list_authors() 

Unfortunately does not give Id. I want to use the get_the_author_meta function for outputting information, which requires an id if outside the loop. Maybe there is another way?

    2 answers 2

    Maybe there is another way?

    The the_author_meta function allows to get ID

    But wp_list_authors so works out of cycle. See add. in Russian

       $args = array( 'role' => 'Author', 'orderby' => 'display_name' ); $wp_user_query = new WP_User_Query($args); $authors = $wp_user_query->get_results(); if (!empty($authors)) { echo '<ul>'; foreach ($authors as $author) { $author_info = get_userdata($author->ID); echo '<li>'.$author->ID.' '.$author_info->user_email.' '.$author_info->last_name.'</li>'; } echo '</ul>'; } else { echo 'No authors found'; }