How To Fix Missing Gravatar ALT Tag Error ( Best Way To Fix )

How To Fix Missing Gravatar ALT Tag Error

How To Fix Missing Gravatar ALT Tag Error ( Best Way To Fix )

 

Easiest way:   Login Cpanel > Site Directory > Wp-content > themes > Your Theme > functions.php

How To Fix Missing Gravatar ALT Tag Error ( Best Way To Fix )

/**
* Gravatar Alt Fix
* https://topnewsarena.com/how-to-fix-missing-gravatar-alt-tag-error
*/
function 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','gravatar_alt');

Copy this following code and past in functions.php

Now save and refresh your website.
If you need more information click here Or click here

If you need help with this function don’t hesitate to comment here. Thank You

 

 

Leave a Reply

Translate »