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

WordPress Trac noreply at wordpress.org
Thu Feb 21 01:23:09 UTC 2019


#30180: wp_get_attachment_image_src does not return alt or meta
-------------------------------------------------+-------------------------
 Reporter:  joedolson                            |       Owner:  joedolson
     Type:  enhancement                          |      Status:  accepted
 Priority:  normal                               |   Milestone:  5.2
Component:  Media                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests 2nd-        |     Focuses:
  opinion                                        |  accessibility
-------------------------------------------------+-------------------------

Comment (by joemcgill):

 @afercia I disagree that `wp_get_attachment_image_src()` should include
 the `alt` attribute. That function in its current form is used in many
 situations where the goal is not to build `img` markup attributes, and in
 those cases, including the `alt` attribute adds an unnecessary post meta
 lookup. Even so, it's understandable, given the name of the function, that
 developers confuse its purpose and use it to build image markup that
 excludes the `alt` attribute. Promoting the usage of the new function
 should help.

 @joedolson I'm open to deprecating it, but that seems to be outside the
 scope of this ticket, and it's such a widely used function—with
 [https://wpdirectory.net/search/01D46T47QBTKXJ7ZBB7FK61SD5 13853 matches
 in the plugin directory]—that I think actual deprecation/removal of the
 function is unlikely, without risking a lot of breakage.

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


More information about the wp-trac mailing list