[wp-hackers] Stumped by WordPress' Admin Menus

Mike Schinkel mikeschinkel at newclarity.net
Tue Jan 11 19:39:19 UTC 2011


On Jan 11, 2011, at 2:17 PM, Peter Westwood wrote:
> You should look at remove_menu_page and remove_submenu_page (introduced in 3.1)
> 
> You can always port them back for your plugin and wrap in function_exists

Thanks for responding.  

Unfortunately, unless I misunderstand those functions do not address the issue.  (In case you've forgotten I was on the IRC chat promoting the needs of those functions when the decision to add them was made.)

The problem is not in getting the values on the global $menu and $submenu arrays to be correct in the admin_menu hook, that's the easy part, the issue is that the code in menu-header.php takes over and make changes immediately before it outputs the HTML to the browser. 

That code has logic built-in to enforce a set of rules that conflict with the needs of several of my clients, and except for buffering the HTML and then scraping and modifying it I can't find a way to get the menus to behave per my clients needs, and certainly 
not in an elegant and robust way.

In case you've missed them here are two tickets that could be used to resolve the issue though I'm sure there are even better ways to deal with this specific issue:

http://core.trac.wordpress.org/ticket/16048
http://core.trac.wordpress.org/ticket/16050

-Mike


More information about the wp-hackers mailing list