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

WordPress Trac noreply at wordpress.org
Tue Oct 24 07:24:39 UTC 2017


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

Comment (by FlorianBrinkmann):

 @birgire regarding the param type: Yes, you are right, thanks for the
 hint!


 > But I read the ticket that such a filter wouldn't be the approach here,
 instead move the internals of `wp_get_attachment_image()` into a new
 function with an array output?

 Yes, I was unsure here what @johnbillion means with »as per the comments
 above« (maybe just the ones directly above? ;) ), but then just created
 the patch, as it was not that time consuming :)

 > If the filter is the way to go, then I wonder about the filter's name
 attachment_image_html - why not e.g. the same as the function's name,
 wp_get_attachment_image?

 It was inspired by the naming of the `post_thumbnail_html` filter, but if
 I am looking at it now; there are already filters like
 `wp_get_attachment_image_attributes`, so yes, maybe it would be better to
 keep it consistent with these filters, include the function’s name, and
 only name it `wp_get_attachment_image`.

 I will update the patch accordingly, maybe it is the approach John means
 :)

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


More information about the wp-trac mailing list