[wp-hackers] Alt text for images wrong or empty in wp_get_attachment_image()

Nathan Rice ncrice at gmail.com
Sun Jan 10 03:14:51 UTC 2010


I noticed the same thing recently. Your patch fixes the problem perfectly.
+1 from me ... this needs to be committed ASAP.

------------------
Nathan Rice
WordPress and Web Development
www.nathanrice.net | twitter.com/nathanrice


On Sat, Jan 9, 2010 at 9:31 PM, Karl Wångstedt <maillist at wangstedt.net>wrote:

> Hi all
>
> I have found a bug in 2.9 where the alt-text for images called via
> wp_get_attachment_image() is missing or wrong. The function 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 committed a bug and a patch to trac here:
> http://core.trac.wordpress.org/ticket/11846
>
> There could be a good thing to expand the function to check if the alt-text
> is set, and if not use the post_excerpt for the image instead. If neither
> the alt-text nor caption is set the title should be used as alt-text.
>
> I think it it is an accessibility problem if the alt-text is left empty.
> Especially since the title is required for the image in the media uploader.
>
> Please review the trac entry and see what you guys think.
>
> Karl Wångstedt
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list