[wp-hackers] Stumped by WordPress' Admin Menus

Mike Schinkel mikeschinkel at newclarity.net
Tue Jan 11 16:32:32 UTC 2011

On Jan 11, 2011, at 5:16 AM, Sergey Biryukov wrote:
> 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.

Agreed, not very elegant.  But thanks for looking at it to see if you could come up with something for me.


More information about the wp-hackers mailing list