Skip to content

Replace the site icon fallback with a gray logo image#11293

Open
sabernhardt wants to merge 5 commits intoWordPress:trunkfrom
sabernhardt:site-icon-gray
Open

Replace the site icon fallback with a gray logo image#11293
sabernhardt wants to merge 5 commits intoWordPress:trunkfrom
sabernhardt:site-icon-gray

Conversation

@sabernhardt
Copy link
Copy Markdown

  • Adds a new gray logo in wp-includes/images. (I started with wp-admin/images/wordpress-logo-gray.svg, added a white background, and used Adobe Illustrator to save as PNG.)
  • Calls the new image in embed site title link and do_favicon() function.
  • Removes custom properties from embed CSS because the variables would not be defined.

Current blue logo
blue icon

Gray logo
gray icon

Trac 64877

Use of AI Tools: none


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 18, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sabernhardt, huzaifaalmesbah, westonruter.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link
Copy Markdown
Member

@huzaifaalmesbah huzaifaalmesbah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Comment on lines +1236 to +1237
esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-gray-white-bg.png' ) ) ),
esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-gray-white-bg.png' ) ) ),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we take this as an opportunity to use the SVG logo instead? This was added to wp-admin recently: https://github.com/WordPress/wordpress-develop/blob/1afbc8ae29e1be0d466182bc74a0c5261b60a70f/src/wp-admin/images/wordpress-logo-gray.svg

Copy link
Copy Markdown
Author

@sabernhardt sabernhardt Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the image I used to create the PNG 😉
though I added a white <circle> for the background:

<circle fill="#ffffff" cx="32" cy="32" r="32"/>

Adding the (modified) SVG in wp-includes/images works when calling it in the embed template.
<img src="http://localhost/dev/src/wp-includes/images/w-logo-gray-white-bg.svg" srcset="http://localhost/dev/src/wp-includes/images/w-logo-gray-white-bg.svg 2x" width="32" height="32" alt="" class="wp-embed-site-icon">

I'm not entirely convinced it should be SVG, but if not, my last commit can be reverted to keep the PNG there.

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' ) ) ),
esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-gray-white-bg.svg' ) ) ),
esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-gray-white-bg.svg' ) ) ),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second instance with the srcset can be eliminated since it is an SVG, right? It's a vector. Or is the reason for the sake of the image being overridden by filters in which case it could be non-vector?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect that most site icons are PNG; the WordPress logo is merely a fallback.

However, the image file is likely often the same for both the 32 and 64 sizes. Maybe it could check whether they match before adding a srcset attribute.

	$site_icon_32 = get_site_icon_url( 32, includes_url( 'images/gray-white-bg.svg' ) );
	$site_icon_64 = get_site_icon_url( 64, includes_url( 'images/gray-white-bg.svg' ) );

	$site_title = sprintf(
		'<a href="%s" target="_top"><img src="%s"%s width="32" height="32" alt="" class="wp-embed-site-icon" /><span>%s</span></a>',
		esc_url( home_url() ),
		esc_url( $site_icon_32 ),
		( $site_icon_32 !== $site_icon_64 ) ? ' srcset="' . esc_url( $site_icon_64 ) . ' 2x"' : '',
		esc_html( get_bloginfo( 'name' ) )
	);

Theoretically someone could use the filter to edit the output, expecting srcset in a str_replace or preg_replace function. On the other hand, Veloria searches only found 4 plugins that add the 'embed_site_title_html' hook:

  • WPSSO Core does not modify the output.
  • TotalPoll and Photo Contest (by the same author) both return an empty string.
  • Embed Your Posts replaces the output entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants