[wp-trac] [WordPress Trac] #43046: `has_image_size()` returns false for Core image sizes

WordPress Trac noreply at wordpress.org
Tue Jan 9 10:00:51 UTC 2018


#43046: `has_image_size()` returns false for Core image sizes
--------------------------+------------------------------
 Reporter:  desrosj       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  3.9
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------
Changes (by subrataemfluence):

 * keywords:  needs-patch => has-patch


Comment:

 `has_image_size()` function is specifically used for image sizes that are
 registered via `add_image_size()` function. It is actually using
 `wp_get_additional_image_sizes()` function, which does not consider core
 image sizes.

 On the other hand `get_intermediate_image_sizes()` uses the same function
 (`wp_get_additional_image_sizes()`) but it forcefully defines an array of
 core image sizes and merges it with the array returned by
 `wp_get_additional_image_sizes()` function.

 I agree with @desrosj that the documentation needs to be more clear about
 this at https://codex.wordpress.org/Function_Reference/has_image_size.

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


More information about the wp-trac mailing list