apply_filters( 'wp_calculate_image_sizes', string $sizes, string|int[] $size, string|null $image_src, array|null $image_meta, int $attachment_id )
- Since
- 4.4.0
Filters the output of 'wp_calculate_image_sizes()'.
Compatibility
- WordPress
- since 4.4.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$sizesstring- A source size value for use in a 'sizes' attribute.
$sizestring|int[]- Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
$image_srcstring|null- The URL to the image file or null.
$image_metaarray|null- The image meta data as returned by wp_get_attachment_metadata() or null.
$attachment_idint- Image attachment ID of the original image or 0.
Where this hook fires · 1
wp-includes/media.php:1632wp_calculate_image_sizes()
Source code
* @param string|int[] $size Requested image size. Can be any registered image size name, or * an array of width and height values in pixels (in that order). * @param string|null $image_src The URL to the image file or null. * @param array|null $image_meta The image meta data as returned by wp_get_attachment_metadata() or null. * @param int $attachment_id Image attachment ID of the original image or 0. */ return apply_filters( 'wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id );} /** * Determines if the image meta data is for the image source file. * * The image meta data is retrieved by attachment post ID. In some cases the post IDs may change.Changelog
Introduced in 4.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.