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
- Adding more options to the instance of an image. (Attachment Display Settings)
- WordPress REST API call generates nonce twice on every call
- Filters ‘request’ and ‘parse_query’ not firing in sites.php nor link-manager.php
- How to trap “Publish” button to check for meta box validation?
- Adding extra pages to plugin that shouldn’t appear in the sidebar
- How do I include background images in my stylesheets in a plugin?
- Custom plugin icon not showing up
- Password field is empty when using wp_signon();
- Show error message after exception handled
- WP Cron being triggered but not working as expected
- Plugin Options Array Set to Undefined
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- Get thumbnails with array sizes parameter
- Adding another field to user table
- Set the payment processor callbacks to a plugin
- WordPress: I wanted to use Add rewrite rule multiple times for multiple CPT in my plugin
- Where to store Plugin specific information in the database
- Any way to make Apache’s internal redirect work?
- New Users are saved with no role selected
- get_option() is undefined in TinymceWindowManager
- WordPress simple ‘Hello World’ plugin – problems