How to display author avatar in Wordpress 5

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.

Answers 1
  • 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')));
    
    0

    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