[wp-trac] [WordPress Trac] #30180: wp_get_attachment_image_src does not return alt or meta

WordPress Trac noreply at wordpress.org
Fri May 13 21:24:00 UTC 2016


#30180: wp_get_attachment_image_src does not return alt or meta
---------------------------------------+----------------------------
 Reporter:  joedolson                  |       Owner:  joedolson
     Type:  defect (bug)               |      Status:  accepted
 Priority:  normal                     |   Milestone:  4.6
Component:  Media                      |     Version:
 Severity:  normal                     |  Resolution:
 Keywords:  needs-testing needs-patch  |     Focuses:  accessibility
---------------------------------------+----------------------------

Comment (by joemcgill):

 As discussed with @joedolson earlier this week, while I am 100% behind the
 intent of this change, I don't think that adding additional attributes to
 `wp_get_attachment_image_src()` is the right approach.

 Instead, I think we should look into creating a new function that reuses
 the internals of `wp_get_attachement_image()` but returns the attributes
 as an array of values. Possibly something like
 `wp_get_attachment_image_data()` or `wp_get_attachment_image_atts()`. We
 can then make `wp_get_attachment_image()` a wrapper function that converts
 the output to HTML.

 Additionally, it might be helpful to have a helper function like
 `wp_get_attachment_image_alt()` that can be used as a standard way of
 generating an `alt` attribute when someone is rolling their own image
 markup.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30180#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list