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
-
$sources
array -
One or more arrays of source data to include in the 'srcset'.
width
arrayurl
stringThe URL of an image source.descriptor
stringThe descriptor type used in the image candidate string, either'w'
or'x'
.value
intThe source width if paired with a'w'
descriptor, or a pixel density value if paired with an'x'
descriptor.
$size_array
arrayAn array of requested width and height values.
- intThe width in pixels.
1
intThe height in pixels.
$image_src
stringThe'src'
of the image.$image_meta
arrayThe image meta data as returned by 'wp_get_attachment_metadata() '.$attachment_id
intImage 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 );
Changelog
Changelog Version Description 4.4.0 Introduced.
User Contributed Notes
-
Skip to note 1 content You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note