#825 closed defect (bug) (invalid)
Wrong info for add_image_size() in the Reference
Reported by: | vloo | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Developer Hub | Keywords: | |
Cc: |
Description
Width and height parameters of the function are said to be required, but they are actually not. The URL of the error:
https://developer.wordpress.org/reference/functions/add_image_size/
Change History (2)
Note: See
TracTickets for help on using
tickets.
The default values are zero, and a width and height of zero makes no sense here. The resulting image will have no dimensions and will ultimately get ignored.
Either the width or the height is indeed required to be non-zero, so that the resulting image will have dimensions after scaling. A zero in one dimension will be ignored by the resizing code, but in both dimensions it will have no reference value to scale to.
Therefore, the explanation as given is correct, albeit incomplete.
Regardless of the technicalities of the actual PHP function call, for the function call to be useful or meaningful, one of those two parameters *is* required. The function cannot be called without them, or it will simply do nothing when it comes time to resize the images.