The WordPress post editor lets you add a featured image to be associated with the post / page / product. They are also referred to as post thumbnails.
Featured images can be set in the post editor using the familiar “Featured image” UI.
Themes can use images set as featured image as, well, a featured image in post listings. Or they can be part of the post content itself, usually seen at the top of the post along with the post title.
These featured images do not have an HTML markup as the other images in the post. It’s up to the theme to “read” the image attributes such as the image title and alt text from the media library.
If you have already updated image attributes for your featured images in the media library and they still do not appear in the front end, the first thing to check is if the theme is actually “reading” them. If not, you might have to ask your developer to make your theme do that.
Every theme is going to be a little different but WordPress does provide some handy functions to pull in the featured image along with the image alt text and title.
- get_the_post_thumbnail() function will return an image markup with the alt text.
- get_post_thumbnail_id() will return the ID of the featured image which can then be used with
get_post_meta( $image_id, '_wp_attachment_image_alt', TRUE )to read the image alt text from the media library.
- If the ID is known, image title can be read using
get_the_title( $image_id )