{ One or more arrays of source data to include in the 'srcset'. @type array $width { @type string $url The URL of an image source. @type string $descriptor The descriptor type used in the image candidate string, either 'w' or 'x'. @type int $value The source width if paired with a 'w' descriptor, or a pixel density value if paired with an 'x' descriptor. } }
$widtharray
@type string $url The URL of an image source.
$descriptorstring
The descriptor type used in the image candidate string, either 'w' or 'x'.
$valueint
The source width if paired with a 'w' descriptor, or a pixel density value if paired with an 'x' descriptor.
$size_arrayarray
{ An array of requested width and height values. @type int $0 The width in pixels. @type int $1 The height in pixels.}
$0int
The width in pixels.
$1int
The height in pixels.
$image_srcstring
The 'src' of the image.
$image_metaarray
The image meta data as returned by 'wp_get_attachment_metadata()'.
1626* @type int$1 The height in pixels.1627*}1628* @param string$image_src The 'src' of the image.1629* @param array$image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.1630* @param int$attachment_id Image attachment IDor0.1631*/1632$sources=apply_filters('wp_calculate_image_srcset',$sources,$size_array,$image_src,$image_meta,$attachment_id);16331634// Only return a 'srcset' value if there is more than one source.1635if(!$src_matched||!is_array($sources)||count($sources)<2){1636returnfalse;1637}1638
History
Introduced in 4.4.0. Unchanged from 6.7.7 through 7.1.0.