Opened 11 years ago
Closed 11 years ago
#34637 closed defect (bug) (fixed)
CPT menu icon leakage
| Reported by: | obenland | Owned by: | obenland |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.4 |
| Component: | Menus | Version: | 4.4 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
11 years ago
In case 34637.2.diff wins: The description of $menu_icon for register_post_type() says "Defaults to use the posts icon.".
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.