I’m writing a couple of plugins. One plugin would be the core plugin with certain bits of functionality.
The other plugin would extend that functionality.
What I’ve done is in the CORE plugin, I’ve created a menu using “add_menu_page” and I also one submenu page in that menu.
Now, as users add more extension plugins I want to add new settings menu items under the CORE plugin menu.
I tried using add_submenu_page in the extender plugin and this adds the submenu. Problem is it gets rid of the main menu sublink in the menu. The link is added to the menu, but when i click it it does not load the right page. I get a 404.
I’m curious what command should I use to add a new submenu page to an already existing admin menu?
Always happens. I ask and immediately find the answer.
The answer is in the 2nd plugin add a “priority” of 11 to the add_action command. This plugs that submenu right in there.
Like this:
add_action('admin_menu', 'admin_submenu', 11);