[wp-trac] [WordPress Trac] #11846: Alt text for images wrong or empty in wp_get_attachment_image()

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 9 20:25:32 UTC 2010


#11846: Alt text for images wrong or empty in wp_get_attachment_image()
----------------------------+-----------------------------------------------
 Reporter:  kallewangstedt  |       Owner:            
     Type:  defect (bug)    |      Status:  new       
 Priority:  normal          |   Milestone:  Unassigned
Component:  Media           |     Version:  2.9       
 Severity:  major           |    Keywords:            
----------------------------+-----------------------------------------------
 When wp_get_attachment_image() is called, it generates the alt-text from
 the post_excerpt field instead of the (new) postmeta field with meta_key
 "_wp_attachment_image_alt". This causes the alt text to not be set even
 though the media editor clearly states that the "Alternate text" field is
 being used as alt text for the image.

 I have attached a patch that corrects this by calling get_post_meta()
 instead of post_excerpt inside the function.

 As a fallback it would be good to expand the function to check if there is
 an alt-text entry, and if not use the caption (post_excerpt) field
 instead, or if only the Title is set use that.

 The alt text should not be empty at all.

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


More information about the wp-trac mailing list