apply_filters( 'wp_omit_loading_attr_threshold', int $omit_threshold )
- Since
- 5.9.0, 6.3.0
Filters the threshold for how many of the first content media elements to not lazy-load.
Description
For these first content media elements, the loading attribute will be omitted. By default, this is the case for only the very first content media element.
Compatibility
- WordPress
- since 6.3.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
$omit_thresholdint- The number of media elements where the
loadingattribute will not be added. Default 3.
Where this hook fires · 1
wp-includes/media.php:6302wp_omit_loading_attr_threshold()
Source code
* * @since 5.9.0 * @since 6.3.0 The default threshold was changed from 1 to 3. * * @param int $omit_threshold The number of media elements where the `loading` attribute will not be added. Default 3. */ $omit_threshold = apply_filters( 'wp_omit_loading_attr_threshold', 3 ); } return $omit_threshold;} /**Changelog
Introduced in 5.9.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.3.0
The default threshold was changed from 1 to 3.from the docblock
5.9.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 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.