[wp-trac] [WordPress Trac] #58361: Passing 'none' as 'menu_icon' to 'register_post_type' is not working correctly
WordPress Trac
noreply at wordpress.org
Tue May 30 19:18:38 UTC 2023
#58361: Passing 'none' as 'menu_icon' to 'register_post_type' is not working
correctly
-------------------------------+------------------------------
Reporter: andrewleap | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 6.2.1
Severity: minor | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Changes (by ironprogrammer):
* keywords: => reporter-feedback
Comment:
Thanks for the report, @andrewleap, and welcome back to Trac!
`register_post_type()` expects that `menu_icon` is a URL, Dashicon, or
base64-encoded SVG. Please see
https://developer.wordpress.org/reference/functions/register_post_type/#menu_icon.
Is your intent to not display any icon at all for the menu?
=== Background
`esc_url( $ptype_obj->menu_icon )` has existed since
https://core.trac.wordpress.org/browser/trunk/wp-
admin/menu.php?rev=14097#L119, and provided a way to add a menu icon by
URL.
Looking deeper into the intent behind `wp-admin/menu-header.php`'s check
for `none` or `div` (see r21877), it seems these values were to be
assigned internally by `wp-admin/menu.php` in the case that `menu_icon`
was **null**. That behavior has since evolved to
[https://developer.wordpress.org/reference/functions/register_post_type/#menu_icon
display the default posts icon].
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58361#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list