apply_filters( 'wp_iframe_tag_add_loading_attr', string|bool $value, string $iframe, string $context )
- Since
- 5.7.0
Filters the
loading attribute value to add to an iframe. Default 'lazy'.Description
Returning false or an empty string will not add the attribute.
Returning true will add the default value.
Compatibility
- WordPress
- since 5.7.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|bool- The
loadingattribute value. Returning a falsey value will result in the attribute being omitted for the iframe. $iframestring- The HTML
iframetag to be filtered. $contextstring- Additional context about how the function was called or where the iframe tag is.
Where this hook fires · 1
wp-includes/media.php:2499wp_iframe_tag_add_loading_attr()
Source code
* * @param string|bool $value The `loading` attribute value. Returning a falsey value will result in * the attribute being omitted for the iframe. * @param string $iframe The HTML `iframe` tag to be filtered. * @param string $context Additional context about how the function was called or where the iframe tag is. */ $value = apply_filters( 'wp_iframe_tag_add_loading_attr', $value, $iframe, $context ); if ( $value ) { if ( ! in_array( $value, array( 'lazy', 'eager' ), true ) ) { $value = 'lazy'; }Changelog
Introduced in 5.7.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.