apply_filters( 'wp_img_tag_add_decoding_attr', string|false|null $value, string $image, string $context )
- Since
- 6.1.0
Filters the
decoding attribute value to add to an image. Default 'async'.Description
Returning a falsey value will omit the attribute.
Compatibility
- WordPress
- since 6.1.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$valuestring|false|null- The
decodingattribute value. Returning a falsey value will result in the attribute being omitted for the image.
Otherwise, it may be: 'async', 'sync', or 'auto'. Defaults to false. $imagestring- The HTML
imgtag to be filtered. $contextstring- Additional context about how the function was called or where the img tag is.
Where this hook fires · 2
wp-includes/deprecated.php:6041wp_img_tag_add_decoding_attr()wp-includes/media.php:2273wp_img_tag_add_loading_optimization_attrs()
Source code
* will result in the attribute being omitted for the image. * Otherwise, it may be: 'async', 'sync', or 'auto'. Defaults to false. * @param string $image The HTML `img` tag to be filtered. * @param string $context Additional context about how the function was called * or where the img tag is. */ $filtered_decoding_attr = apply_filters( 'wp_img_tag_add_decoding_attr', $optimization_attrs['decoding'] ?? false, $image, $context );Changelog
Introduced in 6.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.