wp_get_loading_optimization_attributes
wp_get_loading_optimization_attributes
Appears in: wordpress-6.4, wordpress-6.4.1, wordpress-6.4.2, wordpress-6.4.3, wordpress-6.5, wordpress-6.5.2, wordpress-6.5.3, wordpress-6.5.4, wordpress-6.5.5, wordpress-6.6, wordpress-6.6.1, wordpress-6.6.2, wordpress-6.7, wordpress-6.7.1, wordpress-6.7.2, wordpress-6.8
Hook Type: filter
Displaying hooks found in version: wordpress-6.8apply_filters('wp_get_loading_optimization_attributes') is found 5 times:
- /wp-includes/media.php line 599059865987598859895990599159925993599459955996
* The skip is also applicable
for
`fetchpriority`.
*/
if
(
'template'
===
$context
) {
/** This filter is documented in wp-includes/media.php */
return
apply_filters(
'wp_get_loading_optimization_attributes'
,
$loading_attrs
,
$tag_name
,
$attr
,
$context
);
}
// For now this function only supports images and iframes.
if
(
'img'
!==
$tag_name
&&
'iframe'
!==
$tag_name
) {
/** This filter is documented in wp-includes/media.php */
return
apply_filters(
'wp_get_loading_optimization_attributes'
,
$loading_attrs
,
$tag_name
,
$attr
,
$context
);
- /wp-includes/media.php line 59965993599459955996599759985999600060016002
// For now this function only supports images and iframes.
if
(
'img'
!==
$tag_name
&&
'iframe'
!==
$tag_name
) {
/** This filter is documented in wp-includes/media.php */
return
apply_filters(
'wp_get_loading_optimization_attributes'
,
$loading_attrs
,
$tag_name
,
$attr
,
$context
);
}
/*
* Skip programmatically created images within content blobs
as
they need to be handled together with the other
* images within the post content
or
widget content.
* Without this clause, they would already be considered within their own context which skews the image
count
and
- /wp-includes/media.php line 601260086009601060116012601360146015601660176018
'widget_text_content'
!==
$context
&& doing_filter(
'widget_text_content'
) ||
'widget_block_content'
!==
$context
&& doing_filter(
'widget_block_content'
)
) {
/** This filter is documented in wp-includes/media.php */
return
apply_filters(
'wp_get_loading_optimization_attributes'
,
$loading_attrs
,
$tag_name
,
$attr
,
$context
);
}
/*
* Add `decoding` with a value of
"async"
for
every image unless it has a
* conflicting `decoding` attribute already present.
- /wp-includes/media.php line 60316028602960306031603260336034603560366037
// For any resources, width and height must be provided, to avoid layout shifts.
if
( ! isset(
$attr
[
'width'
],
$attr
[
'height'
] ) ) {
/** This filter is documented in wp-includes/media.php */
return
apply_filters(
'wp_get_loading_optimization_attributes'
,
$loading_attrs
,
$tag_name
,
$attr
,
$context
);
}
/*
* The key function logic starts here.
*/
$maybe_in_viewport
= null;
- /wp-includes/media.php line 617661726173617461756176617761786179618061816182
* @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
apply_filters(
'wp_get_loading_optimization_attributes'
,
$loading_attrs
,
$tag_name
,
$attr
,
$context
);
}
/**
* Gets the threshold
for
how many of the first content media elements to not lazy-load.
*
* This
function
runs the {@see
'wp_omit_loading_attr_threshold'
} filter, which uses a
default
threshold value of 3.