#14282 closed defect (bug) (invalid)
the_post_thumbnail and get_the_post_thumbnail don't populate the images alt text correctly
Reported by: | msigley | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Post Thumbnails | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
Recently was adding in Post Thumbnails for a client's blog and discovered that the "the_post_thumbnail()" function doesn't return an img tag populated by the alt text set for the image in the media gallery.
Did come up with a workaround though:
$thumbnail_id = get_post_thumbnail_id(); $thumbnail_alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); the_post_thumbnail(array(150,150), "alt=$thumbnail_alt_text");
This should be a simple fix of editing the function's output in wp-includes/post-thumbnail-template.php.
Change History (5)
Note: See
TracTickets for help on using
tickets.
Without testing, the code looks proper in wp_get_attachment_image here.