You can make the ‘slug’ for the submenu page equal that of the top level page, and they’ll point to the same place:
add_action('admin_menu', 'my_menu_pages');
function my_menu_pages(){
add_menu_page('My Page Title', 'My Menu Title', 'manage_options', 'my-menu', 'my_menu_output' );
add_submenu_page('my-menu', 'Submenu Page Title', 'Whatever You Want', 'manage_options', 'my-menu' );
add_submenu_page('my-menu', 'Submenu Page Title2', 'Whatever You Want2', 'manage_options', 'my-menu2' );
}
E.g.
Related Posts:
- How to avoid creating first submenu page that is same as menu page?
- Sub Menu content is being duplicated
- Is there documentation reference for forms in menu and setting pages?
- Add Admin menus or submenus depending on conditions
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Change the_title() of a page dynamically
- Plugin – create a page without it appearing in the side menu
- How do I programatically insert a new menu item?
- Add Dividers or Separators Between Nav Menu Items
- Nav Menu meta failing to import
- Overwriting Core WordPress Functions with Plugins
- Some nav-menu filters do nothing
- Determine which theme location a wp_get_nav_menu_items is for
- Can I add pages to my custom menu via script?
- Replacing WordPress menu functionality with a plugin
- How to add more than 1 user role to sub-menu pages
- Odd behaviour with submenu link creation
- Hook event for upload image in the menu
- Why isn’t the Settings API designed to work for plugins using custom admin menus? [duplicate]
- How do I approach removing menu items on the fly based on settings in my plugin?
- add_menu_page() with function inside a class [duplicate]
- What is the difference between current_page_parent and current_page_ancestor?
- Delete a specific item menu when I deactivate my plugin
- Create a Page via plugin
- Add Submenu Link in add_submenu_page That Opens in a New Window
- How to assign a WP 3.0 custom nav menu to a theme’s navigation menu location via script?
- Header Button Chance Polylang Elementor
- PHP 7 – Class Method Compatibility Issue
- How to add pages to custom menus on the fly [duplicate]
- How do I add a custom sublevel menu specified in one directory to a custom top level menu specified in another directory?
- Add notification bubble notice in navigation using transients
- Hiding Admin Page While Keeping Menu Expanded
- Get Current Menu Location inside Nav_Walker
- Adding custom fields to WordPress nav menus
- Plugin menu addition in multisite
- Set different custom menu items for different user roles
- Remove unwanted elements for a wp_nav_menu
- Is this best practice for Dynamically adding items to WordPress menus?
- How to remove or add submenu item on plugin activate or deactive
- Add a page in admin without adding menu item
- Custom code for WordPress dynamic menu
- How do I access the menus produced by Dashboard > Appearance > Menus
- How is a widget supposed to reference what is added to custom submenu or addmenu fields?
- wordpress add_submenu_page adds broken link
- WP Enqueue style on all plug-in pages
- Add child pages to submenu automatically
- Customize existing menu item
- Issue on Setting $icon_url Parameter on WP add_menu_page()
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- Issue with plugin sub menu and pages
- How to add Plugin functionality in WordPress Frontend Menus
- Adding submenu to custom plugin menu page created with add_menu_page() function
- How to hide page links from theme menu
- WP_NAV_MENU filter targets all menus
- How do I add a menu item to a Pods admin menu?
- Add user managable titles to custom menus?
- How to Call Specific .PHP file on add_submenu_page selection in Plugin Development?
- How to create archive page to add in menu
- Why won’t this submenu page show? – My First WordPress Plugin
- How to show only the last two categories in a menu?
- How to create a custom post-new.php page for plugin , no wp menu
- How to add styles to a submenu page?
- Add a custom submenu under submenu in a Custom WordPress Plugin
- Always hide a page from the menu
- remove different admin menu for specific users
- How to get an array out of a nav menu if it’s a plugin?
- What happens when you create/edit a menu
- edit-tags.php in plugin admin menu hides when is the active page
- Plugin admin list pages as submenu
- Adding parent custom post type menu option
- Adding querystring variable breaks admin URLs
- Create and style menu
- Change the class of wordpress menu
- Invalid Menu Items
- Declaration of mandoe_menu_walker::start_el(&$output, $item, $depth, $args) must be compatible with Walker::start_el(…)
- Custom Nav Walker $item->url producing malformed hyperlinks
- Displaying an Uploaded Image as a Custom Avatar in WordPress
- Is it possible to add Custom Dashboard Widgets to Custom Admin Menu Page?
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- Hide menu items from not logged in users
- Custom database table entry edit page
- Is there a way to decide from init whether we are on a certain backend page?
- Create child of child custom page in wp-admin
- adding an options menu that allows saving multiple sets of said options
- How to give a NavWalker its own stylesheet?
- Enqueueing common php scripts in a plugin
- How do I get variables from my plugin’s settings page?
- How add default term meta to prevent an error?
- plugin content on front-page only. Nowhere else
- How to get current logged-in user details in multisite?
- Check if the current user is author of first comment
- WP Plugin with Upgrade option
- Detect change in site_url and home_url
- Reporting errors in a shortcode plugin
- How can I control if post updated
- Does WordPress default CSS have Grids?
- Gravity Forms Anchor only on Front Page?
- How can I create a new menu item that links to an archive of a custom post type?
- shortcode tags not working in do_shortcode
- How to show parents of current page category, excluding the category?