Filter hook 'wp_calculate_image_srcset'

in WP Core File wp-includes/media.php at line 1488

Description

Filters an image's 'srcset' sources. either 'w' or 'x'. pixel density value if paired with an 'x' descriptor. } } }

Occurrences

Filename Line Number
wp-includes/media.php 1488

Parameters

Type Name Description
array $sources { One or more arrays of source data to include in the 'srcset'.
array $size_array { An array of requested width and height values.
string $image_src The 'src' of the image.
array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
int $attachment_id Image attachment ID or 0.

PHP Doc

/**
	 * Filters an image's 'srcset' sources.
	 *
	 * @since 4.4.0
	 *
	 * @param array  $sources {
	 *     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.
	 *     }
	 * }
	 * @param array $size_array     {
	 *     An array of requested width and height values.
	 *
	 *     @type int $0 The width in pixels.
	 *     @type int $1 The height in pixels.
	 * }
	 * @param string $image_src     The 'src' of the image.
	 * @param array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
	 * @param int    $attachment_id Image attachment ID or 0.
	 */