[wp-trac] [WordPress Trac] #34477: Pass the named image size to the filter in `wp_get_attachment_image_sizes()`

WordPress Trac noreply at wordpress.org
Sat Oct 31 16:36:47 UTC 2015


#34477: Pass the named image size to the filter in
`wp_get_attachment_image_sizes()`
--------------------------+-----------------------
 Reporter:  joemcgill     |       Owner:  azaozz
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  4.4
Component:  Media         |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------

Comment (by joemcgill):

 After thinking through this some more, in many cases, the sizes attribute
 can be filtered using the `wp_get_attachment_image_attr` filter, which
 already passes the named size.

 The only place where that's not possible is when we call
 `wp_get_attachment_image_sizes()` in the display filter. In that case, we
 could pass the file name—which we already have—in order to get the same
 result without the need to add any new `preg_match()` calls.
 [attachment:34477.2.patch] adds `$image_url` as an optional param to
 `wp_get_attachment_image_sizes()`, which gets passed to the filter.

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


More information about the wp-trac mailing list