From 6c7bb97313a723e9fc16ff644ca2975efdf61611 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 21 Dec 2020 18:37:47 +0000 Subject: [PATCH] =?UTF-8?q?Twenty=20Twenty-One:=20Do=20not=20specify=20`lo?= =?UTF-8?q?ading=3D=E2=80=9Ceager=E2=80=9D`=20for=20single=20post=20thumbn?= =?UTF-8?q?ails.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While `loading=“eager”` is a supported alternative to omitting the attribute entirely, browsers follow the value of this attribute explicitly when specified. Specifying `eager` would prevent the user from receiving any additional potential benefits implemented at the browser level, such as further mechanisms to automatically decide which elements to lazy-load. Props flixos90, ryelle, poena. Fixes #52139. git-svn-id: https://develop.svn.wordpress.org/trunk@49860 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-content/themes/twentytwentyone/inc/template-tags.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-content/themes/twentytwentyone/inc/template-tags.php b/src/wp-content/themes/twentytwentyone/inc/template-tags.php index faa7e495da..38add801c5 100644 --- a/src/wp-content/themes/twentytwentyone/inc/template-tags.php +++ b/src/wp-content/themes/twentytwentyone/inc/template-tags.php @@ -190,8 +190,8 @@ if ( ! function_exists( 'twenty_twenty_one_post_thumbnail' ) ) {
'eager' ) ); + // Lazy-loading attributes should be skipped for thumbnails since they are immediately in the viewport. + the_post_thumbnail( 'post-thumbnail', array( 'loading' => false ) ); ?>