Repository navigation
✨ feat(menus): take WordPress 7.2 icon names, none and absolute URLs as the menu icon - #146
Merged
Merged
Conversation
…as the menu icon
WordPress 7.2 draws the admin menu with inline SVGs and lets add_menu_page() take the name of a
registered icon (`core-admin/pin`). AdminMenuProvider turned every icon that was not `dashicons*`
or `data:` into a file of the plugin's public/images folder, so an icon name, `none` and an
absolute URL all became a broken <img>.
menuIcon() now passes through what WordPress reads by itself: an icon name where
wp_is_valid_icon_name() exists (7.2+), `none`, an absolute or protocol-relative URL, besides the
Dashicons classes and base64 SVGs. Before 7.2 an icon name stays a file name, as in 3.3.1; a menu
that must run on both gates it in config/menus.php with function_exists('wp_is_valid_icon_name').
…ay what 7.2 reads as an icon name
Collaborator
Author
|
Review. Codex reached its usage limit for the day on round 1, before it read any code. A fresh-context reviewer subagent stood in for it. It found nothing serious and raised four low-severity points:
Its own checks of the test order and the separate process passed. It ran Re-verified on 5c80f97:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
WordPress 7.2 (December 8, 2026) draws the admin menu and the admin bar with inline SVGs, and
add_menu_page()now takes the name of a registered icon such ascore-admin/pin(dev note).AdminMenuProviderturned everyiconofconfig/menus.phpthat was notdashicons*ordata:into a file of the plugin'spublic/imagesfolder. So an icon name, and alsononeand an absolute URL (both already valid for WordPress), became a broken<img>.What
AdminMenuProvider::menuIcon()passes through what WordPress reads by itself:wp_is_valid_icon_name()exists (7.2+)noneAnything else is still a file of the plugin's images.
An absolute URL keeps the
<img>padding rule that plugin images get.Before 7.2 an icon name stays a file name, as in 3.3.1. A menu that must run on both versions gates it in
config/menus.php:The docs page
core-concepts/menus.mdxgets this with the release.The menu
iconof custom post types was already passed toregister_post_type()unchanged, so icon names work there with no change.Verification
AdminMenuProviderTesthas 10 new cases: each form, plus the icon name with and without 7.2'swp_is_valid_icon_name()(the latter in a separate process). Against the 3.3.1AdminMenuProvider, 5 of them fail:none, the three URL forms and the icon name.composer test: 396 tests, all green.menu-icon-live-smoke.sh, in the workspace's.claude/scripts. It copies WPKirk-Developing with the checkout'ssrc/into a local Playground, without touching the shared bench. It gives it five top-level menus, one per icon form, and reads eachdiv.wp-menu-imagefrom the logged-in admin page.core-admin/pin→<img src=".../public/images/core-admin/pin">none→<img src=".../images/none"><img src=".../images/https://example.test/menu.png">core-admin/pinis an inline SVG,nonedraws no image, the URL is loaded as it is, the file name is the plugin's image and the Dashicons class is not an<img>.