Skip to content

Commit

Permalink
[Block Library - Site Logo]: Return nothing if logo is not set (#31513)
Browse files Browse the repository at this point in the history
* 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 <myazalea@hotmail.com>

Co-authored-by: Carolina Nymark <myazalea@hotmail.com>
Co-authored-by: Nik Tsekouras <ntsekouras@outlook.com>
  • Loading branch information
3 people authored May 6, 2021
1 parent 7944946 commit 3fb1e88
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/block-library/src/site-logo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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( '#<a.*?>(.*?)</a>#i', '\1', $custom_logo );
Expand Down

0 comments on commit 3fb1e88

Please sign in to comment.