[wp-trac] [WordPress Trac] #20205: Add the ability to filter wp_get_attachment_image()

WordPress Trac noreply at wordpress.org
Sat May 24 13:51:12 UTC 2014


#20205: Add the ability to filter wp_get_attachment_image()
----------------------------+-----------------------------
 Reporter:  helgatheviking  |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Future Release
Component:  Media           |     Version:  3.4
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+-----------------------------
Changes (by ericlewis):

 * keywords:  has-patch dev-feedback => has-patch


Comment:

 attachment:20205.diff cleans up this function. Let's wrap the
 `image_downsize()` call in a `wp_attachment_is_image()` check, this makes
 more logical sense, even if that check is already in that function. Don't
 short-circuit there, instead carry the returned value (similar to
 @jfarthing74's approach) through the function to be passed into the filter
 at the end of the function.

 On a sidenote, it's convoluted that we offer an 'icon' parameter for this
 function. I would like to see this deprecated, and a separate function
 created, perhaps `wp_get_attachment_icon_src()`.

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


More information about the wp-trac mailing list