How to Fix Missing Gravatar Alt Tag Value in WordPress

If your blog is on WordPress, then there must be some common error in it like the Gravatar ALT tag, in this case, it is necessary to fix this issue so that the ranking of the site increases and its pages can rank in the top.

Read More: How to Fix 502 Bad Gateway Error in WordPress

What is the Gravatar ALT tag missing error?

The author image in a WordPress blog is caused by not adding the Alt tag beforehand. Normal Gravatar ALT tag missing in a WordPress site can be easily fixed by finding it while the Gravatar ALT tag is not, then how to fix it.

How to find Gravatar ALT tag missing issue

This issue will be seen when you check site speed, there are many best tools to check site speed such as google page insights, Gtmatrix, Webdev, etc. You use them, all these sites analyze speed and such. find the element which makes the site run slowly.

How To Fix Gravatar ALT Tag Missing Issue

You can use coding to fix the Gravatar ALT tag missing, you can follow the procedure mentioned here

Step. 1 Copy the below code and log in to WordPress

function crunchify_gravatar_alt($crunchifyGravatar) {
	if (have_comments()) {
		$alt = get_comment_author();
	}
	else {
		$alt = get_the_author_meta('display_name');
	}
	$crunchifyGravatar = str_replace('alt=\'\'', 'alt=\'Avatar for ' . $alt . '\' title=\'Gravatar for ' . $alt . '\'', $crunchifyGravatar);
	return $crunchifyGravatar;
}
add_filter('get_avatar', 'crunchify_gravatar_alt');

Step.2 Open Appearance > Theme editor > Function.php file in WordPress Dashboard and paste the copied code in the Function.php file last And click on File Update.

If you do not want to edit the theme, then you can use the Code snippet plugin to insert the code. If your website’s Gravatar ALT tag missing issue has been fixed, you can use google page insights to check it.

If you have any questions or feedback related to this post, then definitely tell us if you think this post is useful, then definitely share it on social sites.

Leave a Comment