Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/wp-includes/general-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,11 @@ function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
} else {
$size_data = array( $size, $size );
}
$url = wp_get_attachment_image_url( $site_icon_id, $size_data );

$site_icon_url = wp_get_attachment_image_url( $site_icon_id, $size_data );
if ( $site_icon_url ) {
$url = $site_icon_url;
}
}

if ( $switched_blog ) {
Expand Down
14 changes: 14 additions & 0 deletions tests/phpunit/tests/general/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,20 @@ public function test_get_site_icon_url() {
$this->assertEmpty( get_site_icon_url(), 'Site icon URL should not be set after removal.' );
}

/**
* @ticket 65098
* @group site_icon
* @covers ::get_site_icon_url
*/
public function test_get_site_icon_url_uses_fallback_when_site_icon_url_is_unavailable() {
update_option( 'site_icon', 999999 );

$this->assertSame(
'https://example.org/fallback.png',
get_site_icon_url( 32, 'https://example.org/fallback.png' )
);
}

/**
* @group site_icon
* @covers ::site_icon_url
Expand Down
Loading