Media: Disable lazy-loading for custom logos by default.

Custom site logos are most commonly displayed above the fold, so lazy-loading is unnecessary.

Props demetris, khag7, johnbillion, rebasaurus, audrasjb.
Fixes #50933.

git-svn-id: https://develop.svn.wordpress.org/trunk@48870 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2020-08-27 01:06:01 +00:00
parent c7f5af72dc
commit 066882a4a8

View File

@ -1000,6 +1000,7 @@ function has_custom_logo( $blog_id = 0 ) {
* *
* @since 4.5.0 * @since 4.5.0
* @since 5.5.0 Added option to remove the link on the home page with `unlink-homepage-logo` theme support. * @since 5.5.0 Added option to remove the link on the home page with `unlink-homepage-logo` theme support.
* @since 5.5.1 Disabled lazy-loading by default.
* *
* @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog. * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
* @return string Custom logo markup. * @return string Custom logo markup.
@ -1018,7 +1019,8 @@ function get_custom_logo( $blog_id = 0 ) {
// We have a logo. Logo is go. // We have a logo. Logo is go.
if ( $custom_logo_id ) { if ( $custom_logo_id ) {
$custom_logo_attr = array( $custom_logo_attr = array(
'class' => 'custom-logo', 'class' => 'custom-logo',
'loading' => false,
); );
$unlink_homepage_logo = (bool) get_theme_support( 'custom-logo', 'unlink-homepage-logo' ); $unlink_homepage_logo = (bool) get_theme_support( 'custom-logo', 'unlink-homepage-logo' );