Toolbar: optimization: add 64px crop size for the site icon#12607
Toolbar: optimization: add 64px crop size for the site icon#12607fushar wants to merge 1 commit into
Conversation
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
0d4c7c7 to
d87ce0c
Compare
Trac ticket: https://core.trac.wordpress.org/ticket/65668
What
A follow-up to #11781 (site icon in the admin bar). The toolbar builds a 2x
srcsetfor retina displays:wordpress-develop/src/wp-includes/admin-bar.php
Lines 397 to 404 in d792cbd
But
WP_Site_Icononly generates crops at270, 192, 180, 32. There is no 64px crop:wordpress-develop/src/wp-admin/includes/class-wp-site-icon.php
Lines 46 to 64 in d792cbd
So the
get_site_icon_url( 64 )call finds no exact match and falls back to get the first larger size than 64, which is the default thumbnail size (150 x 150). This is too large to serve a 20x20 (or 28x28 in mobile) site icon in the admin bar.This PR simply adds a new
64entry to it. With this, browsers can download much smaller image file in retina displays.Note
This only affects NEW site icon uploads. Existing icons unfortunately won't get the new crop size until it's reuploaded.
This will also benefit the post embeds as it also calls
get_site_icon_url( 64 ):wordpress-develop/src/wp-includes/embed.php
Line 1242 in d792cbd
Testing
See the difference in the image file sizes:
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Opus 4.8
Used for: brainstorming and code generation; reviewed by me.
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.