[wp-trac] [WordPress Trac] #65345: Site Icon subsizes use wrong array key 'width ' instead of 'width'
WordPress Trac
noreply at wordpress.org
Tue May 26 11:49:58 UTC 2026
#65345: Site Icon subsizes use wrong array key 'width ' instead of 'width'
-------------------------------------------------+-------------------------
Reporter: tomatillo | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Media | Version: 4.3
Severity: normal | Resolution:
Keywords: has-patch needs-testing has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Changes (by sabernhardt):
* version: 7.0 => 4.3
Old description:
> In WP_Site_Icon::additional_sizes(), site icon subsize definitions use
> the array key `'width '` (with a trailing space) instead of `'width'`.
>
> File: wp-admin/includes/class-wp-site-icon.php
> Method: WP_Site_Icon::additional_sizes()
>
> The image editor reads $size_data['width']. Because the key is wrong,
> width is null and subsizes are not generated as intended square crops.
>
> Steps to reproduce:
> 1. Set site_icon to a non-square attachment without going through the
> Customizer crop UI (e.g. assign an existing landscape photo).
> 2. Regenerate or create site_icon-* subsizes.
> 3. Inspect attachment metadata sizes site_icon-192, site_icon-32, etc.
>
> Expected: 192x192, 32x32 square crops.
> Actual: non-square dimensions (e.g. 256x192, 43x32).
>
> Impact: get_site_icon_url() may fall back to the full scaled image for
> head meta tags.
>
> Fix: change `'width '` to `'width'` on the site_icon subsize definition
> line.
New description:
In `WP_Site_Icon::additional_sizes()`, site icon subsize definitions use
the array key `'width '` (with a trailing space) instead of `'width'`.
File: `wp-admin/includes/class-wp-site-icon.php`
Method: `WP_Site_Icon::additional_sizes()`
The image editor reads `$size_data['width']`. Because the key is wrong,
width is null and subsizes are not generated as intended square crops.
Steps to reproduce:
1. Set `site_icon` to a non-square attachment without going through the
Customizer crop UI (e.g. assign an existing landscape photo).
2. Regenerate or create `site_icon-*` subsizes.
3. Inspect attachment metadata sizes `site_icon-192`, `site_icon-32`, etc.
Expected: 192x192, 32x32 square crops.
Actual: non-square dimensions (e.g. 256x192, 43x32).
Impact: `get_site_icon_url()` may fall back to the full scaled image for
head meta tags.
Fix: change `'width '` to `'width'` on the `site_icon` subsize definition
line.
--
Comment:
The array key has been `'width '` since
[https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/site-
icon.php?rev=32994&marks=553#L553 r32994].
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65345#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list