[wp-hackers] something wrong with adding menus for plugin

Davit Barbakadze jayarjo at gmail.com
Sun Mar 14 17:02:11 UTC 2010


I'm trying to add one Top Menu and couple of SubMenus with the following code:

add_menu_page( Popups, Popups, 10, page_popups, array($this, page_popups) );
add_submenu_page( page_popups, Edit, Edit, 10, page_popups,
array($this, page_popups) );
add_submenu_page( page_popups, Add New, Add New, 10, page_add_new,
array($this, page_add_new) );

In the first add_submenu_page call I'm using that trick where $parent
= $file to prevent duplication of top menu as a first submenu, and the
trick works... at least
visually. But functionally when I click on either top menu or first
submenu (not duplicated) I get corresponding callback called twice...

But why? Isn't this how it needs to be done. I remember picking this
technique in
Codex (http://codex.wordpress.org/Adding_Administration_Menus). Is it
how it is meant to work?

Any help appreciated.

-- 
Davit Barbakadze


More information about the wp-hackers mailing list