Opened 10 years ago
Closed 10 years ago
#34637 closed defect (bug) (fixed)
CPT menu icon leakage
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.4 | Priority: | normal |
| Severity: | normal | Version: | 4.4 |
| Component: | Menus | Keywords: | has-patch |
| Focuses: | Cc: |
Description
When a Custom Post Type (CPT) that doesn't define menu_icon happens to be registered after a CPT that does define menu_icon, that icon will then be attached to both.
In wp-admin/menu.php we loop through all post types and check if the menu_icon property is a string, and if it's not, if the post type is built-in, to define the $menu_icon variable. If that is both not true (like when menu_icon was never set), $menu_icon stays unchanged from the previous loop.
Attachments (3)
Change History (7)
#3
@
10 years ago
In case 34637.2.diff wins: The description of $menu_icon for register_post_type() says "Defaults to use the posts icon.".
Note: See
TracTickets for help on using
tickets.
Doing some more testing I noticed how there is no de facto default menu icon for CPT. The default icon just happens to be whatever icon was defined for the CPT before.
On a trunk install, the above will use the page's icon, since it will be output right after it.
@DrewAPicture suggested to use the page icon for hierarchical CPTs and the post icon for non-hierarchical ones.