Filter hook 'wp_img_tag_add_srcset_and_sizes_attr'

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

Description

Filters whether to add the `srcset` and `sizes` HTML attributes to the img tag. Default `true`. Returning anything else than `true` will not add the attributes.

Occurrences

Filename Line Number
wp-includes/media.php 2180

Parameters

Type Name Description
bool $value The filtered value, defaults to `true`.
string $image The HTML `img` tag where the attribute should be added.
string $context Additional context about how the function was called or where the img tag is.
int $attachment_id The image attachment ID.

PHP Doc

/**
	 * Filters whether to add the `srcset` and `sizes` HTML attributes to the img tag. Default `true`.
	 *
	 * Returning anything else than `true` will not add the attributes.
	 *
	 * @since 5.5.0
	 *
	 * @param bool   $value         The filtered value, defaults to `true`.
	 * @param string $image         The HTML `img` tag where the attribute should be added.
	 * @param string $context       Additional context about how the function was called or where the img tag is.
	 * @param int    $attachment_id The image attachment ID.
	 */