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

WordPress Trac noreply at wordpress.org
Thu Sep 19 19:31:41 UTC 2019


#30180: wp_get_attachment_image_src does not return alt or meta
----------------------------+-----------------------------
 Reporter:  joedolson       |       Owner:  antpb
     Type:  enhancement     |      Status:  assigned
 Priority:  normal          |   Milestone:  Future Release
Component:  Media           |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  needs-dev-note  |     Focuses:  accessibility
----------------------------+-----------------------------
Changes (by joemcgill):

 * type:  defect (bug) => enhancement


Comment:

 I agree with @azaozz.

 I'd like to see an approach to this function that has a similar signature
 to `wp_get_attachment_image_src()`, that accepts `$attachment_id` and
 `$size` and returns a full set of attributes for creating an `img` tag.
 This new function should probably be used in the internals of
 `wp_get_attachment_image()` to generate a default set of attributes and
 should be the place where the `wp_get_attachment_image_attributes` filter
 is applied, rather than having confusing duplicate filters.

 I'm also changing this ticket back to an enhancement ticket, because
 that's really what it is. There isn't a bug being fixed by this ticket,
 but instead is providing a new public function that can be used as a best
 practice by people building interfaces on top of WordPress.

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


More information about the wp-trac mailing list