1

How could i get List of all the Authors?

author.php file shows the Information about Individual Author.

for example: http://domain.com/author/bj

that returns the Bj's Profile.

if i enter http://domain.com/author it returns 404 Not Found

Author page shows author's avatar, Author's Name and description.

how can i list out all the authors?

Need Help!

3 Answers 3

2

You can display author's list by using function wp_list_authors

for more info : http://codex.wordpress.org/Function_Reference/wp_list_authors

And for author Template Hierarchy see below link

http://codex.wordpress.org/Author_Templates

0
10

Use function get_users(). It returns an array of all authors. With foreach it is possible to loop over the array and display its content. There are a lot of attributes going with the user object. Here is an example:

$users = get_users();
foreach ($users as $user) 
{
   echo $user->ID;
   echo $user->display_name;
   the_author_image($user->ID);
   echo $user->description;
}
2
  • 1
    This is more flexible than wp_list_authors
    – Nathan
    Mar 18, 2020 at 2:18
  • 1
    Note: the_author_image is not native wp function
    – kanlukasz
    Jul 30, 2020 at 8:09
0
$authors = get_users([
    'fields'  => ['ID', 'display_name'],
    'role'    => 'author',
    'orderby' => 'display_name',
]);

Additionally, if you want to add avatars:


array_walk($authors, function (&$author) {
    $author->avatar_url = get_avatar_url($author->ID);
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.