How to display author avatar in Wordpress 5

Created at 08-Feb-2022 , By samar

How to display author avatar in Wordpress 5

Hello everyone, in this post we will examine how to solve the "How to display author avatar in Wordpress 5" programming puzzle.

You can display author avatar in Wordpress. You have to call the get_avatar() method to get the author avatar in posts or pages in Wordpress.
  • Display author avatar in wordpress 5

    --PATH wp-content\themes\<twentytwentyone>\<header>.php
    echo get_avatar($id_or_email = get_the_author_meta('user_email'),  
                    $size = 50, 
                    $args = array('class' => array( 'avatar', 'img-circle')));
    

    You can use the get_avatar() method to get the author avatar in wordpress. In my case, I have used it in my wp-content\themes\twentytwentyone\header.php file to get the author avatar in my website header section. You can use it anywhere as per your requirement.

Back to code snippet queries related wordpress

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.