From 815fa67a0eb39c8ceff9be1c918cbaf9dd3fda63 Mon Sep 17 00:00:00 2001 From: Jeff Ong Date: Wed, 5 May 2021 12:46:46 -0400 Subject: [PATCH 1/3] Return if no custom logo is set. --- packages/block-library/src/site-logo/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/site-logo/index.php b/packages/block-library/src/site-logo/index.php index f14feb0cb07a8f..7bb8e2c3f3904a 100644 --- a/packages/block-library/src/site-logo/index.php +++ b/packages/block-library/src/site-logo/index.php @@ -22,8 +22,13 @@ function render_block_core_site_logo( $attributes ) { }; add_filter( 'wp_get_attachment_image_src', $adjust_width_height_filter ); + $custom_logo = get_custom_logo(); - $classnames = array(); + if ( empty( $custom_logo ) ) { + return ''; + } + + $classnames = array(); if ( ! empty( $attributes['className'] ) ) { $classnames[] = $attributes['className']; } From 65379fdadafa338a7aafd56cbecde23a44f4951f Mon Sep 17 00:00:00 2001 From: Jeff Ong Date: Wed, 5 May 2021 14:37:46 -0400 Subject: [PATCH 2/3] Comment the early return. --- packages/block-library/src/site-logo/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/site-logo/index.php b/packages/block-library/src/site-logo/index.php index 7bb8e2c3f3904a..654730d865e7d3 100644 --- a/packages/block-library/src/site-logo/index.php +++ b/packages/block-library/src/site-logo/index.php @@ -25,7 +25,7 @@ function render_block_core_site_logo( $attributes ) { $custom_logo = get_custom_logo(); if ( empty( $custom_logo ) ) { - return ''; + return ''; // Return early if no custom logo is set, avoiding extraneous wrapper div. } $classnames = array(); From c23471c1f1bfd5b0524c82f64f0b7b9441d07763 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Thu, 6 May 2021 15:16:55 +0300 Subject: [PATCH 3/3] Update packages/block-library/src/site-logo/index.php Co-authored-by: Carolina Nymark --- packages/block-library/src/site-logo/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/site-logo/index.php b/packages/block-library/src/site-logo/index.php index 43392796c344f6..96e8bdf9cd9578 100644 --- a/packages/block-library/src/site-logo/index.php +++ b/packages/block-library/src/site-logo/index.php @@ -27,7 +27,7 @@ function render_block_core_site_logo( $attributes ) { if ( empty( $custom_logo ) ) { return ''; // Return early if no custom logo is set, avoiding extraneous wrapper div. - } + } if ( ! $attributes['isLink'] ) { // Remove the link.