The add_menu_page documentation says to pass the menu title as the second parameter:

add_menu_page('Page Title', 'Menu Title', ...);

When adding more pages later via add_submenu_page, the main page becomes the first entry in the submenu:

enter image description here

However, I want the first item in the list to have a different name (but still point to the same page), the way Wordpress itself does it:

enter image description here

How could I accomplish that in my plugin?


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' );


enter image description here

  • This would result in duplicate entries, since Wordpress automatically creates a submenu page for the main page.
    – MegaHit
    Sep 27 '12 at 23:37
  • 7
    I remember skimming through the core code last week and running into a note that said something like: "Add default submenu item IF USER HASN'T ALREADY". It checks to see if there's a submenu item pointing to the top level item. If there is, it doesn't add the default. Sep 27 '12 at 23:40
  • I want when i create custom menu i want to display some tables and data as other tabs are display a tutorial link or some function help will be appreciated Oct 23 '16 at 19:40
  • Exactly what I waas looking for. Thanx :P
    – Rob D. A.
    Sep 10 '18 at 15:13
  • this works fine for me too still... Apr 6 '20 at 22:01

make the slug of parent menu item and sub menu same (first one item) like below

function actions_recent_bids_add_admin_page(){

add_menu_page('Recent Bids', 'Auction Reports', 'manage_options','wc-auction-reports','actions_recent_bids_list','dashicons-chart-area', 56);   
    'wc-auction-reports',               // parent slug
    'Recent Bids',                      // page title
    'Recent Bids',                      // menu title
    'manage_options',                   // capability
    'wc-auction-reports',               // slug
    'acutions_customers_spendings_list' // callback

    'wc-auction-reports',               // parent slug
    'Customer Spending',                // page title
    'Customer Spending',                // menu title
    'manage_options',                   // capability
    'wc-acutions-customers-spendings',  // slug
    'acutions_customers_spendings_list' // callback
    'wc-auction-reports',          // parent slug
    'Customer Bids',               // page title
    'Customer Bids',               // menu title
    'manage_options',              // capability
    'wc-acutions-customers-bids',  // slug
    'acutions_customers_bids_list' // callback



Simply add this:

$submenu['my-menu'][0][0] = 'My New Menu Title';

For debugging purposes, you can do a print_r($menu) to check the whole WP menu.

        'tut_theme_settings',       // parent slug
        'Front Page Elements 2',    // page title
        'Front Page 2',             // menu title
        'manage_options',           // capability
        'tut_theme_settings2',      // slug
        'theme_front_page_settings' // callback

if different name of first sub-menu create same slug of parent and first child and call same function

  • 2
    How is it different from the accepted answer? And to which action this should be hooked.
    – bravokeyl
    Sep 29 '16 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.