This guide helps you easily fix missing Gravatar ALT and title tags that some user experience with their sites. Fixing the missing Gravatar alt description is very easy and you can make this fix without any plugins, all you will need to do is add a function to your MU plugins or to your theme functions.php. You can also add this function using the My Custom Functions plugin, this might be the best option if you don’t fully understand the functions.php file or MU plugins.
Fixing the missing Gravatar is important to make sure your site passes an SEO audit, missing alt descriptions will flag as an error in an SEO audit.
/** * Gravatar Alt Fix */ function lakewood_gravatar_alt($text) { $alt = get_the_author_meta( 'display_name' ); $text = str_replace('alt=\'\'', 'alt=\'Avatar for '.$alt.'\' title=\'Gravatar for '.$alt.'\'',$text); return $text; } add_filter('get_avatar','lakewood_gravatar_alt');
The above function will pull the author display name to use in the alt description and title tag. I have also added some extra text to make it more readable, you can change this.

Adam
Editor of the Lakewood Journal and the founder of Lakewood media. Also an avid landscape and travel photographer.
You may also like
Beginner’s Guide to Nofollow, Sponsored, and UGC Tags: Understanding and Implementing Proper Link Attributes
In this beginner's guide, we will delve into the specifics of each tag, their purpose, and how to implement them effectively.
0 Comments12 Minutes
How to Recover from a Negative SEO Attack and Protect Your Website
Our SEO team explain the steps you can take to recover from a negative SEO attack and protect your website from future harm.
0 Comments5 Minutes