On this page
apply_filters( 'wp_calculate_image_srcset', array $sources, array $size_array, string $image_src, array $image_meta, int $attachment_id )
Filters an image’s ‘srcset’ sources.
Parameters
$sourcesarray-
One or more arrays of source data to include in the 'srcset'.
widtharrayurlstringThe URL of an image source.descriptorstringThe descriptor type used in the image candidate string, either'w'or'x'.valueintThe source width if paired with a'w'descriptor, or a pixel density value if paired with an'x'descriptor.
$size_arrayarrayAn array of requested width and height values.
- int
The width in pixels.
1intThe height in pixels.
$image_srcstringThe'src'of the image.$image_metaarrayThe image meta data as returned by 'wp_get_attachment_metadata() '.$attachment_idintImage attachment ID or 0.Source
File:
wp-includes/media.php. View all references$sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id );Related
Used By
Used By Description wp_calculate_image_srcset() wp-includes/media.php A helper function to calculate the image sources to include in a ‘srcset’ attribute.
Changelog
Version Description 4.4.0 Introduced.
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/wp_calculate_image_srcset