Image for header menu – SEO issue
-
Hi,
Hi,
I noticed today that all Images for the header menu are stripped of image ALT text (well, not completely). Image ALT text is taken from the menu title, even if each icon (picture) has an image ALT. For example, in the Menu category Anniversary Cards, my ALT text: Anniversary menu icon featuring two engaging rings; however, when I did an inspect page, image ALT text: Anniversary Cards for this icon. Same for all icons for other categories.
https://ibb.co/4Rm67bJp
https://ibb.co/Ld0sZRB9
https://ibb.co/0jmf8Vf6
Thanks
Hello,
Is there any chance that you could give me access to the dashboard area so I can check the settings there?
Looking forward to collaborating with you!
Kind Regards
Hi,
Thank you.
You can find details in private section.
Hello,
The alt text to that image comes from the title of the category – https://prnt.sc/O-OcjtNtsX_A
To have the alt text from the image, paste the code below in the fucntions.php file in your child theme:
add_filter('wp_get_attachment_image_attributes', function ($attr, $attachment, $size) {
$id = $attachment->ID;
$alt = trim( strip_tags( get_post_meta( $id, '_wp_attachment_image_alt', true ) ) );
if ( $alt ) {
$attr['alt'] = $alt;
}
return $attr;
}, 10, 3);
Kind Regards
Perfect. Thank you co much.
Please close this ticket.
Hello,
You are welcome! If you do not mind, can you please leave a 5 stars rating for our theme by going here: http://themeforest.net/downloads It will allow us to release more updates and provide dedicated support in the future. It would encourage our work a lot.
Have a good day!
Kind Regards
The topic ‘Image for header menu – SEO issue’ is closed to new replies.