[wp-trac] [WordPress Trac] #37479: Ambiguous use of first parameter in wp_calculate_image_sizes

WordPress Trac noreply at wordpress.org
Thu Sep 15 03:40:18 UTC 2016


#37479: Ambiguous use of first parameter in wp_calculate_image_sizes
-------------------------+----------------------
 Reporter:  smerriman    |       Owner:
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  Media        |     Version:  4.6
 Severity:  normal       |  Resolution:  wontfix
 Keywords:               |     Focuses:
-------------------------+----------------------
Changes (by joemcgill):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 Hi @smerriman,

 Thank you for the report.

 The reason this function was designed to accept `$size` as both a string
 and an array is to be consistent with how `$size` is used in other image
 functions, like `wp_get_attachment_image()`. Internally in core, we are
 using an array for performance reasons (to avoid the extra metadata lookup
 if I recall correctly), but this function could also be used by theme or
 plugin authors to generate custom markup, in which case, being able to
 pass the named size to `wp_calculate_image_sizes()` is sometimes
 preferred.

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


More information about the wp-trac mailing list