[wp-hackers] Stumped by WordPress' Admin Menus

Sergey Biryukov sergeybiryukov.ru at gmail.com
Tue Jan 11 10:16:25 UTC 2011


On Tue, Jan 11, 2011 at 1:32 AM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> Although there are other issues I've had with the admin menu system (described here[1]) the problem I am having today is that the menu_page seems to inherit the first URL from the submenu_page and no matter what I try I can't get them decoupled. To illustrate the point I've created a very simple example:
>
> add_action('admin_menu','my_admin_menu');
> function my_admin_menu() {
>        global $submenu;
>        unset($submenu['edit.php'][5]);    // Remove 'Posts'
>        unset($submenu['edit.php'][10]);   // Remove 'Add New'
>        $submenu['edit.php'][15][0] = 'Post Categories';
>        unset($submenu['edit.php'][16]);   // Remove 'Post Tags'
> }

Since $submenu_as_parent lacks a filter which could help here, the
only other option I can think of is to leave the "Posts" item in the
array and then hide it via CSS. Still not very elegant.


More information about the wp-hackers mailing list