最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

List of all authors avatars

programmeradmin0浏览0评论

I'm looking for a way to retrieve all authors with their avatar.

I know there is a way to get an authors avatar but I want to get all avatars of all the authors :)

echo get_avatar(get_the_author_meta('ID'), '160');

I tried to combine this command with wp_list_authors() but didn't find a way.

How can I retrieve a list of all authors with their avatars?

Thank you!

I'm looking for a way to retrieve all authors with their avatar.

I know there is a way to get an authors avatar but I want to get all avatars of all the authors :)

echo get_avatar(get_the_author_meta('ID'), '160');

I tried to combine this command with wp_list_authors() but didn't find a way.

How can I retrieve a list of all authors with their avatars?

Thank you!

Share Improve this question asked Oct 18, 2020 at 17:20 user196295user196295 3
  • Keep in mind that authors are just users that have posts, behind the scenes wp_list_authors just uses the user API functions, and so can you, get_the_author_meta is just a wrapper around get_user_meta( $post->post_author, 'ID'... – Tom J Nowell Commented Oct 18, 2020 at 18:17
  • Use wp_list_authors() and put them into an array then loop through the array using get_avatar() for each. – Tony Djukic Commented Oct 18, 2020 at 19:24
  • I don't believe wp_list_authors is the solution, that function returns a HTML/plaintext string rather than an array of users – Tom J Nowell Commented Oct 18, 2020 at 21:45
Add a comment  | 

1 Answer 1

Reset to default 0

I would loop through an array with the authors and then get their avatar and save them in a different array. You can use get_users() to get the users and you already know how to get their avatar.

You can get users using get_users() by giving it an array with arguments to specify what you need. You can see the available arguments to pass in the documentation for get_users(). This will return an array with users to loop through.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论