the_post_thumbnail and get_the_post_thumbnail don't populate the images alt text correctly
|Reported by:||msigley||Owned by:|
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)
- Keywords needs-patch added; post thumbnail alt text removed
- Milestone changed from Awaiting Review to Future Release