Fix Missing Gravatar ALT & Title Tags

Contents

Build your own WordPress Support Plan

Expert, yet affordable WordPress support & maintenance plans.
View our pricing

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.

Written By
Adam
Founder of WP Helper.
You will also like these articles

Relax Knowing Your WordPress Site Is Secure & Running Smoothly 24/7

Let us manage your WordPress site, everything from security to updates will be taken care of. Support plans also come with dedicated support so we can do anything from adding content to customising your site for you.

Same Day Professional WordPress Support

Get WordPress Support Today

Need help with a single WordPress problem, today? We can help with anything from adding analytics tracking code to site hack recovery. Full money back guarantee on all jobs.

1. Submit a Support Request

Use our support ticket form below to send details of your problem to our developers.

2. Get a Quote

We will review your request and provide a quote within 24 hours (but usually within a few hours).

3. We fix your WordPress problem

Our team will begin fixing your WordPress problem the same day.

4. 100% Money Back Guarantee

If we can’t fix the problem for the amount quoted we will refund you 100%.

  • Do you have a screenshot of the issue or have a copy of the theme or plugin that is at fault? If you want to upload php, html or css please zip first.
    Drop files here or
    Accepted file types: jpg, jpeg, png, pdf, zip, gzip, rar, doc, txt, Max. file size: 15 MB, Max. files: 10.