Creating an admin dashboard menu without a corresponding submenu entry
-
Hello! I’m making a small MU plugin, and have ran into a small issue. I have a menu entry in the administrator dashboard that looks like this: https://i.imgur.com/6UpZYwD.png but I was hoping to have it look like this: https://i.imgur.com/4P5f5yL.png. Essentially, I’d like the add_menu_page function to not create a corresponding sub-menu item. I see that plugins like WordFence are able to achieve this, but I couldn’t find any examples online showing how. Is there a setting I’m missing? Here is the code I’m using to generate the menu:
<?php /** * standard boilerplate */ defined("ABSPATH") or die("this file can't be run directly"); /** * settings menu */ add_action("admin_menu", "example_settings_menu"); function example_settings_menu() { add_menu_page( "Example Plugin", "Example Options", "manage_options", "exop", "example_settings", "dashicons-archive", 4 ); add_submenu_page( "exop", "Example Plugin", "Sub-entry 1", "manage_options", "sub-one", "example_settings_one" ); add_submenu_page( "exop", "Example Plugin", "Sub-entry 2", "manage_options", "sub-two", "example_settings_two" ); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Creating an admin dashboard menu without a corresponding submenu entry’ is closed to new replies.