Remove Avatars from WordPress Blog Comments

Remove Avatars from WordPress Blog Comments

Avatars appear on every blog comment section on WordPress websites. These avatars are shown therein format of jpg. So it’s obvious that it also affects website load time.

Now if a website does have more than 50 comments means there will a chance of more than 50 avatars in the comment area. So this will decrease post speed very much.

So, To remove these avatars there is a direct option available in the WordPress admin area.

Here are the steps to follow to disable these avatars from the comment section.

Settings > Discussion to disable avatars sitewide

But this will remove author avatar too. Now there is one more solution that keeps the author’s avatar and removes only avatars from the comments area.

Open functions.php file of your current theme and add the following lines at the end of this file.

/**
* Remove avatars from comment list
* @link https://ajaykhandal.com/remove-avatars-from-wordpress-blog-comments/
*/

function aj_remove_avatars_from_comments( $avatar ) {
global $in_comment_loop;
return $in_comment_loop ? '' : $avatar;
}
add_filter( 'get_avatar', 'aj_remove_avatars_from_comments' );

× Chat with me