From 3fb1e88c61e2839eb4149744dae8b1f01f6ba4d2 Mon Sep 17 00:00:00 2001 From: Jeff Ong Date: Thu, 6 May 2021 06:14:21 -0700 Subject: [PATCH] [Block Library - Site Logo]: Return nothing if logo is not set (#31513) * Return if no custom logo is set. * Comment the early return. * Update packages/block-library/src/site-logo/index.php Co-authored-by: Carolina Nymark Co-authored-by: Carolina Nymark Co-authored-by: Nik Tsekouras --- packages/block-library/src/site-logo/index.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/block-library/src/site-logo/index.php b/packages/block-library/src/site-logo/index.php index 81933db0f8b465..96e8bdf9cd9578 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(); + if ( empty( $custom_logo ) ) { + return ''; // Return early if no custom logo is set, avoiding extraneous wrapper div. + } + if ( ! $attributes['isLink'] ) { // Remove the link. $custom_logo = preg_replace( '#(.*?)#i', '\1', $custom_logo );