[wp-trac] [WordPress Trac] #27399: Filter the HTML output of wp_get_attachment_image

WordPress Trac noreply at wordpress.org
Fri Nov 11 13:03:16 UTC 2016


#27399: Filter the HTML output of wp_get_attachment_image
-----------------------------+-----------------------
 Reporter:  fgirardey        |       Owner:
     Type:  enhancement      |      Status:  reopened
 Priority:  normal           |   Milestone:
Component:  Media            |     Version:  3.8.1
 Severity:  normal           |  Resolution:
 Keywords:  has-patch close  |     Focuses:
-----------------------------+-----------------------

Comment (by joemcgill):

 I still think adding an additional filter on the built HTML here is
 unnecessary and could lead to more problems than it solves, since this is
 the function used throughout the admin for displaying images. It seems to
 me that if you're trying to use `wp_get_attachment_image` for anything
 other than outputting an `img` element based on an attachment ID and size,
 then you're using the wrong tool.

 However, I could see a need to abstract the internals of
 `wp_get_attachment_image` into a function that returns the attributes of
 an image as an array so it's easier to build your own custom HTML. We
 could then make `wp_get_attachment_image` a wrapper that is based on the
 new function.

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


More information about the wp-trac mailing list