1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function);
example for tools menu
*/
add_action('admin_menu', 'add_submenu_item');
 
function add_submenu_item(){
     add_submenu_page( 'tools.php', 'My Tool', 'My Tool', 'manage_options', 'my-tool', 'display_page');
     // or
     // add_management_page( 'My Tool', 'My Tool', 'manage_options', 'my-tool', 'display_page' );
} 
 
/**
- Settings: options-general.php or use add_options_page()
- Dashboard: index.php or use add_dashboard_page()
- Posts: edit.php or use add_posts_page()
- Pages: edit.php?post_type=page or use add_pages_page()
- Custom post type: edit.php?post_type=custom_post_type
- Media: upload.php  or use add_media_page()
- Comments: edit-comments.php or use add_comments_page()
- Appearance: themes.php or use add_theme_page()
- Plugins: plugins.php or use add_plugins_page()
- Users: users.php or use add_users_page()
- Tools: tools.php or use add_management_page()
*/
Add submenu item to admin menu
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *