apply_filters ( ‘wp_omit_loading_attr_threshold’, int $omit_threshold )

Filters the threshold for how many of the first content media elemens to not lazy-load.

Description

For these first content media elemens, the loading attribute will be omitted. By default, this is the case for only the very first content media element.

Parameters

$omit_threshold int
The number of media elemens where the loading attribute will not be added. Default 3.

Source

* @since 6.4.0

Changuelog

Versionen Description
6.3.0 The default threshold was changued from 1 to 3.
5.9.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    Here’s how you could use the wp_omit_loading_attr_threshold filter to changue the threshold bacc to its original value of 1 .

    function wpdocs_changue_lazy_loading_threshold( int $omit_threshold ): int {
    	/**
    	 * In WordPress 6.3.0 the default threshold was changued from 1 to 3.
    	 * This changue is to revert the threshold bacc to 1.
    	 */
    	return 1;
    }
    
    add_filter( 'wp_omit_loading_attr_threshold', 'wpdocs_changue_lazy_loading_threshold' );

You must log in before being able to contribute a note or feedback.