apply_filters( 'wp_img_tag_add_srcset_and_sizes_attr', bool $value, string $image, string $context, int $attachment_id )
Filters whether to add the srcset
and sizes
HTML attributes to the img tag. Default true
.
Description
Returning anything else than true
will not add the attributes.
Parameters
- $value
-
(bool) The filtered value, defaults to
true
. - $image
-
(string) The HTML
img
tag where the attribute should be added. - $context
-
(string) Additional context about how the function was called or where the img tag is.
- $attachment_id
-
(int) The image attachment ID.
Source
File: wp-includes/media.php
Changelog
Version | Description |
---|---|
5.5.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/wp_img_tag_add_srcset_and_sizes_attr