Skip to content

Commit

Permalink
Docs: Correct duplicate hook reference for wp_min_priority_img_pixels.
Browse files Browse the repository at this point in the history
The original filter location is `wp_maybe_add_fetchpriority_high_attr()` in `wp-includes/media.php`.

This commit updates the instance in `wp_get_loading_optimization_attributes()` to point to the correct file.

Follow-up to [56037], [56143], [56347].

Props tmatsuur, rajinsharwar, khokansardar.
Fixes #59067.

git-svn-id: https://develop.svn.wordpress.org/trunk@56386 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Aug 11, 2023
1 parent 92521d7 commit 27da228
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -5772,7 +5772,7 @@ function wp_get_loading_optimization_attributes( $tag_name, $attr, $context ) {
if ( $increase_count ) {
wp_increase_content_media_count();
} elseif ( $maybe_increase_count ) {
/** This filter is documented in wp-admin/includes/media.php */
/** This filter is documented in wp-includes/media.php */
$wp_min_priority_img_pixels = apply_filters( 'wp_min_priority_img_pixels', 50000 );

if ( $wp_min_priority_img_pixels <= $attr['width'] * $attr['height'] ) {
Expand Down Expand Up @@ -5862,6 +5862,7 @@ function wp_maybe_add_fetchpriority_high_attr( $loading_attrs, $tag_name, $attr
$loading_attrs['fetchpriority'] = 'high';
wp_high_priority_element_flag( false );
}

return $loading_attrs;
}

Expand All @@ -5882,10 +5883,12 @@ function wp_maybe_add_fetchpriority_high_attr( $loading_attrs, $tag_name, $attr
* @param int $threshold Minimum square-pixels threshold. Default 50000.
*/
$wp_min_priority_img_pixels = apply_filters( 'wp_min_priority_img_pixels', 50000 );

if ( $wp_min_priority_img_pixels <= $attr['width'] * $attr['height'] ) {
$loading_attrs['fetchpriority'] = 'high';
wp_high_priority_element_flag( false );
}

return $loading_attrs;
}

Expand All @@ -5904,5 +5907,6 @@ function wp_high_priority_element_flag( $value = null ) {
if ( is_bool( $value ) ) {
$high_priority_element = $value;
}

return $high_priority_element;
}

0 comments on commit 27da228

Please sign in to comment.