From 93bf4a6d6f66a6d8a97f263c38b7cab057c01130 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 11 Aug 2023 11:35:19 +0000 Subject: [PATCH] Docs: Correct duplicate hook reference for `wp_min_priority_img_pixels`. 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. Built from https://develop.svn.wordpress.org/trunk@56386 git-svn-id: http://core.svn.wordpress.org/trunk@55898 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index e0f2154e0b..990aa272f4 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -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'] ) { @@ -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; } @@ -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; } @@ -5904,5 +5907,6 @@ function wp_high_priority_element_flag( $value = null ) { if ( is_bool( $value ) ) { $high_priority_element = $value; } + return $high_priority_element; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 2bfff3d33c..83b0286e92 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56385'; +$wp_version = '6.4-alpha-56386'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.