Opened 16 years ago
Closed 16 years ago
#11846 closed defect (bug) (fixed)
Alt text for images wrong or empty in wp_get_attachment_image()
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 3.0 | Priority: | normal |
| Severity: | major | Version: | 2.9 |
| Component: | Media | Keywords: | has-patch |
| Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
Patch for wp_get_attachment_image()