You can try this.
add_action( 'admin_menu', 'register_my_custom_menu_page' );
function register_my_custom_menu_page() {
add_menu_page(
'My Custom Page',
'My Custom Page',
'manage_options',
'my-top-level-slug',
'',
'dashicons-menu',
6
);
add_submenu_page( 'my-top-level-slug', 'My Custom Page', 'My Custom Page',
'manage_options', 'my-top-level-slug', 'custom_subpage_first');
add_submenu_page( 'my-top-level-slug', 'My Custom Submenu Page 1', 'My Custom
Submenu Page','manage_options', 'my-secondary-slug', 'custom_subpage_second');
}
function custom_subpage_first() {
?>
<div class="wrap">
<?php include_once(dirname( __FILE__ ) . "/file.htm");?>
</div>
<?php
}
function custom_subpage_second() {
?>
<div class="wrap">
/*Second subpage content */
</div>
<?php
}
Related Posts:
- Add an admin page, but don’t show it on the admin menu
- Getting custom admin submenu item to highlight when its active
- Order Admin sub-menu items?
- How Can I remove or hide the export page in WordPress menu?
- Admin Menu – Highlight top-level menu when on a sub-menu page (without showing sub-menu)
- Is it possible to pass variables from add_user_page?
- Adding a submenu to the Tools menu returns tools.php in a popup box
- What action/filter/function determines “current” class in WP Admin Menu
- Additional menu item popping in submenus
- add sub_menu to a sub_menu (multiLevel sub_menu) in admin menu in wordpress
- How to have submenus collapsed until they are clicked?
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- The Great WordPress Admin Menu Challenge of Jan 2011 (a.k.a. How to Resolve Some Challenges when Modifying the WordPress Admin Menu System?)
- Plugin View Details Link
- Are there any reasons you can’t use strings for admin menu positions?
- Add separator to admin submenu
- List table not rendering when $this->items is filled
- Reorder custom submenu item
- How to check if an admin (sub)menu already exists?
- How Do I Programmatically Better Organize Custom Post Type Menus?
- Is there a way to keep a custom menu expanded when editing a custom post type?
- custom admin menu with custom filed
- Add highlighting to new Admin Dashboard Menu Item
- Remove menus and submenus
- Highlighting a Menu Item by Post Name
- How to remove the Plugins Editor from the admin menu
- add logout button on admin side menu
- Admin custom option screen not saved unless user manage_options capability
- WordPress admin menu formatting issue
- How to minimize WP dashboard menu programmatically?
- how to only add a top-level admin menu without it creating a sub-level-menu
- WordPress add_options_page() function not considering role
- How to determin which admin screen/sub screen I’m currently viewing
- Add post-new.php?post_cat=catslug to admin menu
- How do I insert the smaller variant of an image?
- Why add_menu_page adds admin.php and how to remove it?
- Is there any way to add absolute path for add_menu_page function?
- Removing “Sub-menus” from My Sites Drop-down in Admin Bar
- Admin menu bar dropdown opens when I click on a form element (Chrome) [closed]
- how can i add custom menu in admin panel?
- Change top level menu item to point to custom submenu item
- Logout hyperlink within a sub-menu
- Change URL of plugin admin menu
- How to add_menu_page include a php file page from theme directory
- How do I demote a menu item in the admin menu?
- place a direct link to custom-stylesheet, under appearance menu in wp-admin
- Is there a limit to the number of items that can be added using the Appearance Menus Screen?
- Insert & order custom post types in/as submenu
- Wrong current class on admin menu with add_submenu_page()
- Role capability issue
- WordPress Remove Submenus
- ‘Headers already sent’ Error When Redirecting from add_submenu_page() Callback
- Admin: sub menu doesnt display under apperance when activate my themes
- Use Drag & Drop Functionality from WordPress Admin Area in the Frontend?
- Print Dashboard submenu name and filename
- Adding admin top-level menus
- Disordered sidebar in admin panel of self-hosted blog network [duplicate]
- How to rename Profile link in wp-admin page
- toolbar not visible on pages using front-page template
- How to align the top of an admin pointer to the target element?
- Why WP_Screeen doesn’t show all options with admin_body_class
- Disable new Site Health screen safely?
- Adding menu item to WordPress admin bar for editors to edit one plugin’s settings
- Moving Smush plugin menu position to media submenu and removing it from main menu
- add submenu page doesn’t display
- Moving the WordPress dashboard avatar over the admin menu
- WordPress plugins add parent menu option in admin main right
- update_option does not work in this scenario – how do I fix?
- Change menu order of core post-type in UI?
- How to reference an existing css content-based icon, within my admin menu hook
- Margin problem on management menu?
- How can I move Customizer menu item to first level in WP Dashboard?
- How can I restrict a custom WordPress role access to only a specific plugin?
- How can I reorder admin bar items?
- Remove submenu item from list
- How do you add a settings page to another menu?
- Admin sidebar customization
- How would one add a nonce to a menu item in the WordPress dashboard?
- How to access wordpress menu & submenu item through the REST API?
- Different Admin language
- add_menu_page not show link for custom role
- Unable to add custom page to WordPress admin panel
- How to add a notification next to custom admin menu?
- admin menu: use default “general” page for theme settings using add_menu_page and add_submenu_page
- How to redirect one admin URL to another when admin page URL has “/admin.php?page=” in it?
- how to remove wp admin menu created by plugin
- Renaming post to something else, breaks dashboard if edit_posts is false
- Removing admin menu items with white spaces
- How can I modify text in admin bar?
- How to include the admin bar?
- Remove the theme info from main dashboard screen- not appearance
- How to add admin bar only page?
- Hiding an added admin page menu using css
- Turn on again old expandable menu
- How to create editable menu with parent and child in wordpress?
- How to unset adminmenu completely?
- Responsive Admin Themes
- Add items to the dark menu in WordPress
- Adding admin link to Appearance via admin_menu, adds link to theme details modal
- Remove menu pages only for non admin