Home / Forums / WoodMart support forum / Image Alt Text Not Displayed in HTML Despite Being Set in Media Library
Home › Forums › WoodMart support forum › Image Alt Text Not Displayed in HTML Despite Being Set in Media Library
Image Alt Text Not Displayed in HTML Despite Being Set in Media Library
- This topic has 9 replies, 2 voices, and was last updated 11 months, 2 weeks ago by
Hung Pham.
-
AuthorPosts
-
July 20, 2025 at 9:38 pm #675171
medmoParticipantI am using the Woodmart theme with Gutenberg to build my pages. I’ve noticed a recurring issue: although I set the alt text for each image during upload, the generated HTML on the front-end shows an empty alt=”” attribute.
July 21, 2025 at 11:15 am #675246
Hung PhamParticipantHi medmo,
Thanks for reaching to us.
Try to add the following PHP code snippet to the child theme functions.php file:
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);Regards,
Hung PDJuly 21, 2025 at 12:57 pm #675274
medmoParticipantHi there,
Same Problem. Please check the HP images to see the problem (made with Gutenberg editor)
Thanks
July 21, 2025 at 1:44 pm #675293
Hung PhamParticipantHi medmo,
I created a test page https://bornesderecharge.ma/37275-2/ and alt are showing https://ibb.co/PGxDh8Bf
Regards,
Hung PDJuly 21, 2025 at 1:50 pm #675296
medmoParticipantYes i know, the problem are only in elements Xtemos that use images in Gutenberg like slider, carrousel ….
Check the HP elements to understand better
Thank you,
-
This reply was modified 11 months, 2 weeks ago by
medmo.
July 22, 2025 at 10:02 am #675432
Hung PhamParticipantHi medmo,
Please record a video that demonstrates the problem so we can understand and reproduce it on your website.
Kind Regards,
Hung PDJuly 22, 2025 at 1:31 pm #675497
medmoParticipantJuly 23, 2025 at 9:59 am #675656
Hung PhamParticipantHi medmo,
Please make sure you added
Altto images https://ibb.co/mrz36J5R > https://ibb.co/62m6GhXRegards,
Hung PDJuly 23, 2025 at 12:45 pm #675744
medmoParticipantThanks, but we dont have this field (image alt/title) in the Carroussel element or Slider element,
How to fix Alt texte for such elements ?
For exemple the slider background in the HP, the alt test not display i added it manuely in the media files but without success
Thanks,
July 24, 2025 at 10:10 am #675939
Hung PhamParticipantHi medmo,
You need to fill the Alt into images directly.
Regards,
Hung PD -
This reply was modified 11 months, 2 weeks ago by
-
AuthorPosts
- You must be logged in to create new topics. Login / Register