• How to avoid double menu ? I need to keep one Configuration. My code is like below.

    add_menu_page('Plugin Config', 'Configuration', 'manage_options', 'settings_menu', 'settings_function');
    add_submenu_page('settings_menu', 'Plugin Config', 'API Key', 'manage_options', 'submenu-handle', 'settings_function');

    I am getting output like below.

    https://i.stack.imgur.com/7IDJw.png

Viewing 2 replies - 1 through 2 (of 2 total)
  • Use remove_submenu_page( 'settings_menu','settings_menu' ); after add_submenu_page line.

    Moderator bcworkz

    (@bcworkz)

    Or let the first submenu item below the main menu item have the same menu slug to avoid double items. Instead of 'submenu-handle', use 'settings_menu'. However, either way, the main and first submenu items are going to the same resource even if they have different labels and callback args.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Avoid double menu in Admin Panel’ is closed to new replies.