Title: wp_omit_loading_attr_threshold
Published: February 3, 2022
Last modified: February 24, 2026

---

# apply_filters( ‘wp_omit_loading_attr_threshold’, int $omit_threshold )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#wp--skip-link--target)

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

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#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.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#parameters)󠁿

 `$omit_threshold`int

The number of media elements where the `loading` attribute will not be added. Default
3.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#source)󠁿

    ```php
    $omit_threshold = apply_filters( 'wp_omit_loading_attr_threshold', 3 );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/media.php#L6227)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/media.php#L6227-L6227)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_omit_loading_attr_threshold()](https://developer.wordpress.org/reference/functions/wp_omit_loading_attr_threshold/)`wp-includes/media.php` |

Gets the threshold for how many of the first content media elements to not lazy-load.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.3.0](https://developer.wordpress.org/reference/since/6.3.0/) | The default threshold was changed from 1 to 3. | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/?output_format=md#comment-content-6964)
 2.   [Robert C.](https://profiles.wordpress.org/rawbird/)  [  2 years ago  ](https://developer.wordpress.org/reference/hooks/wp_omit_loading_attr_threshold/#comment-6964)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_omit_loading_attr_threshold%2F%23comment-6964)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_omit_loading_attr_threshold%2F%23comment-6964)
 4. Here’s how you could use the `wp_omit_loading_attr_threshold` filter to **change
    the threshold back to its original value of 1**.
 5.     ```php
        function wpdocs_change_lazy_loading_threshold( int $omit_threshold ): int {
        	/**
        	 * In WordPress 6.3.0 the default threshold was changed from 1 to 3.
        	 * This change is to revert the threshold back to 1.
        	 */
        	return 1;
        }
    
        add_filter( 'wp_omit_loading_attr_threshold', 'wpdocs_change_lazy_loading_threshold' );
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_omit_loading_attr_threshold%2F%3Freplytocom%3D6964%23feedback-editor-6964)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_omit_loading_attr_threshold%2F)
before being able to contribute a note or feedback.