Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The solution depends on how your theme outputs featured images. In any case, having code add arbitrary alt attribute text is not accomplishing the intent of having alt attributes. How would code determine what the text should be? Would it always be “featured image” or similar? That’s not helpful to those that rely upon alt attributes.

    The WP function for outputting featured image tags uses the alt text value specified in the media library. You should provide meaningful text for every image instead of providing a meaningless static value via filter hook.

    To partly answer your question, assuming your theme uses WP functions to output featured image tags, the filter ‘post_thumbnail_html’ can be used to alter the img tag HTML.

Viewing 1 replies (of 1 total)
  • The topic ‘add alt text to featured image in posts’ is closed to new replies.