[wp-trac] [WordPress Trac] #14282: the_post_thumbnail and get_the_post_thumbnail don't populate the images alt text correctly

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 12 15:18:35 UTC 2010


#14282: the_post_thumbnail and get_the_post_thumbnail don't populate the images alt
text correctly
-----------------------------+----------------------------------------------
 Reporter:  msigley          |       Owner:                           
     Type:  defect (bug)     |      Status:  new                      
 Priority:  normal           |   Milestone:  Awaiting Review          
Component:  Post Thumbnails  |     Version:  2.9.2                    
 Severity:  normal           |    Keywords:  post thumbnail, alt, text
-----------------------------+----------------------------------------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14282>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list