Make WordPress Core

Opened 14 years ago

Closed 11 years ago

Last modified 11 years ago

#14282 closed defect (bug) (invalid)

the_post_thumbnail and get_the_post_thumbnail don't populate the images alt text correctly

Reported by: msigley's profile 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)

#1 @msigley
14 years ago

  • Version changed from 2.9.2 to 3.0

#2 @nacin
14 years ago

  • Keywords needs-patch added; post thumbnail alt text removed
  • Milestone changed from Awaiting Review to Future Release

#3 @nacin
14 years ago

  • Keywords reporter-feedback added; needs-patch removed

Without testing, the code looks proper in wp_get_attachment_image here.

#4 @iseulde
11 years ago

  • Resolution set to invalid
  • Status changed from new to closed

No feedback in over three years.

#5 @helen
11 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.