Gets the threshold for how many of the first content media elements to not lazy-load.
Description
This function runs the ‘wp_omit_loading_attr_threshold’ filter, which uses a default threshold value of 3.
The filter is only run once per page load, unless the $force
parameter is used.
Parameters
$force
booloptional- If set to true, the filter will be (re-)applied even if it already has been before.
Default:
false
Source
* @global WP_Query $wp_query WordPress Query object.
*
* @param string $tag_name The tag name.
* @param array $attr Array of the attributes for the tag.
* @param string $context Context for the element for which the loading optimization attribute is requested.
* @return array Loading optimization attributes.
*/
function wp_get_loading_optimization_attributes( $tag_name, $attr, $context ) {
global $wp_query;
/**
* Filters whether to short-circuit loading optimization attributes.
*
* Returning an array from the filter will effectively short-circuit the loading of optimization attributes,
* returning that value instead.
*
* @since 6.4.0
*
* @param array|false $loading_attrs False by default, or array of loading optimization attributes to short-circuit.
* @param string $tag_name The tag name.
* @param array $attr Array of the attributes for the tag.
Changelog
Version | Description |
---|---|
5.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.