mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Media: Avoid programmatically created images within post content from incorrectly receiving fetchpriority="high"
.
Follow-up to [56037], as that changeset accidentally did not consider the changes made in [55825]: Images that are programmatically injected into post content (e.g. through a block, or shortcode, or any hook calling a function like `wp_get_attachment_image()`) must be treated as part of the whole post content blob since otherwise the heuristics for applying `fetchpriority="high"` and `loading="lazy"` are skewed by parsing certain images before others rather than sequentially parsing the entire post content. [55825] addressed that for lazy-loading, but when [56037] introduced `fetchpriority` support, the related refactor missed making the same consideration for that attribute. Props flixos90, spacedmonkey, thekt12, mukesh27. Fixes #58235. See #58089. Built from https://develop.svn.wordpress.org/trunk@56164 git-svn-id: http://core.svn.wordpress.org/trunk@55676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ea399e28a9
commit
bb8ad05161
@ -5666,11 +5666,12 @@ function wp_get_loading_optimization_attributes( $tag_name, $attr, $context ) {
|
||||
/*
|
||||
* Skip programmatically created images within post content as they need to be handled together with the other
|
||||
* images within the post content.
|
||||
* Without this clause, they would already be counted below which skews the number and can result in the first
|
||||
* post content image being lazy-loaded only because there are images elsewhere in the post content.
|
||||
* Without this clause, they would already be considered below which skews the image count and can result in
|
||||
* the first post content image being lazy-loaded or an image further down the page being marked as a high
|
||||
* priority.
|
||||
*/
|
||||
if ( doing_filter( 'the_content' ) ) {
|
||||
return $postprocess( $loading_attrs, true );
|
||||
return $loading_attrs;
|
||||
}
|
||||
|
||||
// Conditionally skip lazy-loading on images before the loop.
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-beta3-56163';
|
||||
$wp_version = '6.3-beta3-56164';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user