I have created a custom top menu in admin panel and also add two submenu for that menu. my code is as follows:
add_action(\'admin_menu\', \'my_create_menu\');
f
You can achieve this by giving the top-level page (the add_menu_page()
call) the same slug as the first submenu page. Then reference this slug in the first parameter of both add_submenu_page()
calls.
Here's the code:
add_menu_page(
'My custom menu Settings',
'My custom menu Settings',
'manage_options',
'sub-suge',
'my_custom_menu',
plugins_url( 'assets/images/test.png', __FILE__ )
);
add_submenu_page(
'sub-suge' ,
'My custom submenu-1',
'My custom submenu-1',
'manage_options',
'sub-suge',
'my_custom_submenu_1'
);
add_submenu_page(
'sub-suge' ,
'My custom submenu-2',
'My custom submenu-2',
'manage_options',
'sub-page',
'my_custom_submenu_2'
);