[wp-trac] [WordPress Trac] #65098: get_site_icon_url() returns empty string even when fallback is defined, breaking wp-embed-site-icon in the_embed_site_title()

WordPress Trac noreply at wordpress.org
Sat Apr 18 18:00:39 UTC 2026


#65098: get_site_icon_url() returns empty string even when fallback is defined,
breaking wp-embed-site-icon in the_embed_site_title()
--------------------------+-----------------------------
 Reporter:  pontocinza    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Embeds        |    Version:  6.9.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In `wp-includes/embed.php`, the function `the_embed_site_title()` calls
 `get_site_icon_url()` twice, passing a fallback URL as the second
 argument:

     esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-blue.png'
 ) ) ),
     esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-blue.png'
 ) ) ),

 Despite a Site Icon being properly defined in Appearance → Customize →
 Site
 Identity (a 512×512px image), `get_site_icon_url()` returns an empty
 string,
 ignoring the fallback entirely. This results in a broken icon in all
 oEmbed
 cards rendered via `the_embed_site_title()`.

 The generated HTML is:

     <img src="" srcset=" 2x" width="32" height="32" alt="" class="wp-
 embed-site-icon">

 Note that `src` is empty and `srcset` contains only ` 2x`, which causes
 browsers to interpret it as a relative URL request to `/embed/2x`,
 returning
 a 403 error.

 The WordPress logo fallback (`w-logo-blue.png`) is also never used,
 contrary
 to the documented behavior of `get_site_icon_url()`.

 == Steps to reproduce ==

 1. Set a Site Icon in Appearance → Customize → Site Identity (512×512px
 image)
 2. Create a post
 3. On another page, add a Media & Text block or an Embed block pointing to
    that post's URL
 4. Visit the page — the site icon in the oEmbed card footer will be broken
 5. Inspect the element: `src=""` and `srcset=" 2x"`

 == Expected behavior ==

 The site icon should display correctly, or — if unavailable — the
 WordPress
 logo fallback (`w-logo-blue.png`) should be used instead.

 == Actual behavior ==

 `get_site_icon_url()` returns an empty string regardless of the defined
 icon
 or fallback, producing a malformed `<img>` tag with empty `src` and
 `srcset`.

 == Workaround ==

 The following filter removes the broken icon from the embed footer:

     add_filter('embed_site_title_html', function($site_title) {
         return preg_replace('/<img[^>]+class="wp-embed-site-
 icon"[^>]*>/i', '', $site_title);
     });

 == Environment ==

 - WordPress 6.9.4
 - PHP (production server)
 - Site Icon defined, 512×512px, uploaded via Customizer
 - APCu object cache active
 - Cloudflare in front of the site

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/65098>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list