Make WordPress Core


Ignore:
Timestamp:
06/15/2026 08:47:05 PM (4 months ago)
Author:
westonruter
Message:

Embeds: Preserve the site icon fallback URL.

Previously, get_site_icon_url() overwrote a caller-supplied fallback URL with the return value of wp_get_attachment_image_url() even when that lookup returned false, so a defined fallback (such as the bundled WordPress logo) was silently discarded whenever the assigned site icon attachment could not be resolved. Only update the URL when a non-empty attachment URL is returned.

Additionally, the_embed_site_title() now renders the site icon <img> only when a URL is available, and omits the srcset attribute when the 2x URL is missing or identical to the 1x URL. This avoids the malformed markup (an empty src and a bare 2x srcset) that produced a broken image and spurious requests in oEmbed cards.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/11601.
Follow-up to r35571, r36693, r47832.

Props sukhendu2002, sabernhardt, mukesh27, westonruter, pontocinza, mohamedahamed, abcd95, manhar, rollybueno.
Fixes #65098.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r62454 r62502  
    979979                        $size_data = array( $size, $size );
    980980                }
    981                 $url = wp_get_attachment_image_url( $site_icon_id, $size_data );
     981                $attachment_url = wp_get_attachment_image_url( $site_icon_id, $size_data );
     982                if ( $attachment_url ) {
     983                        $url = $attachment_url;
     984                }
    982985        }
    983986
Note: See TracChangeset for help on using the changeset viewer.