Having trouble with ALT and TITLE tag for Gravatars and SEO?

Having problems with search engine optimization on your web site?

Your ALT and TITLE tag checker is failing on gravatars on your web site.

Use this code snippet and resolve issues.

/*
* This is function that adds ALT and TITLE for gravatars
* It's very important in terms of SEO compliance.
*/
function replace_content($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','replace_content');

careveloper

We are educational service which provides resources to help you manage your digital service. Here you will find resources about WordPress development, how to build up your own web site weather it is a simple blog or advanced e-commerce web site.

Leave a Reply

Your email address will not be published. Required fields are marked *