Make Admin Menu Generation Hookable
|Reported by:||mikeschinkel||Owned by:|
This ticket proposes to make the code that generates the admin menus "hookable." It removes the hard-coded call to _wp_menu_output() and replaces it with a priority 0 call to the 'adminmenu' hook that currently immediately precedes the existing call to _wp_menu_output(). It also adds an add_action() call to assign _wp_menu_output() to be called by the 'adminmenu' hook at priority 0.
With the exception of a plugin or theme using a negative or zero priority for the 'adminmenu' hook this hook will be 100% backward compatible.
Currently _wp_menu_output() in /wp-admin/menu-header.php is coded with very few hooks making it hard at time to modify for client requirements.
The admin menu variables $menu and $submenu use numeric array indexes for menu page and submenu page placement which makes it harder to ensure that plugins and themes that modify admin menus are robust and compatible with other plugins and themes that modify admin menus. It's been discussed that thIs admin menu structure is suboptimal but for sake of backward compatibility it's wisely been decided to maintain it as is.
This hook would allow a site developer to build his or her own admin menus without modifying core. It would allow a theme vendor to do the same with the caveat that replacing the admin menu means that other plugins or themes might not work as expected. In general this might be a problem but for those building custom solutions based on WordPress, especially when they are building products based on WordPress (as I am) this would be extremely helpful. If it was felt necessary to ensure people don't do this without understanding the compatibilities issues a requirement to first set a constant like 'INCOMPATIBLE_ADMIN_MENUS' could be required to make it work.
Enabling this would also enable people (like me) to explore building admin menus such that in the future better admin menus could evolve to the point they are well thought out enough to actually replace the core admin menus.
So hopefully since this is such a small patch, introduces no new hooks, and is 99.999% backward compatible it should be a no-brainer?
Change History (13)
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
comment:6 mikeschinkel — 3 years ago
- Resolution wontfix deleted
- Status changed from closed to reopened
- Resolution set to maybelater
- Status changed from reopened to closed