Offer Image
55%OFF
Last Price Drop

Your Clients Will thank you

00

Days

00

Hours

00

Min

00

Sec

Grab the Deal

How to Add a Menu to the WordPress Admin Dashboard (the wp-admin Sidebar)

Key Takeaways

  • The WordPress admin menu is the sidebar inside wp-admin, which is separate from the navigation menu visitors see on the front end of the site.
  • The add_menu_page() function, hooked to admin_menu, adds a new top-level item to the WordPress admin sidebar with a title, capability, slug, callback, icon and position.
  • The add_submenu_page() function adds a child item under any parent slug, either your own custom menu or a core screen such as tools.php.
  • WordPress multisite registers network admin menu items on the separate network_admin_menu hook, usually with the manage_network_options capability.
  • WP Adminify's Menu Editor at Adminify > Admin Menu renames, re-links, re-icons, reorders, separates and hides existing WordPress admin menu items by role or user without code.

To add a menu to the WordPress admin dashboard, you register a new item with the add_menu_page() function on the admin_menu hook. This puts a new link and page in the wp-admin sidebar, next to Posts, Media and Settings. In our test on WordPress 7.1.4, one add_menu_page() call added a "Client Guide" item with its own icon and help page.

This guide is about the admin menu, the dark sidebar you see after you log in. It covers the code route for brand-new items and submenus, and the no-code route for changing the items you already have. If you mainly want to reorder or hide items, start with our guide to customize the WordPress admin menu. For a plugin-based way to manage the sidebar, see the admin menu editor tool in WP Adminify.

Admin Menu vs Navigation Menu: Which One Do You Need?

WordPress uses the word "menu" for two different things. The admin menu is the sidebar inside wp-admin that only logged-in users see. The navigation menu is the list of links visitors use in your site header or footer. Each one is built in a different place, with different tools.

FactorAdmin menuNavigation menu
Who sees itLogged-in users inside wp-adminSite visitors on the front end
Where it livesLeft sidebar of the dashboardHeader, footer or sidebar of your theme
How you add itemsCode (add_menu_page()) or an admin pluginAppearance > Menus or the Site Editor
Controlled byUser capabilitiesTheme menu locations

This post covers only the admin menu. If you came here to build the menu in your site header, read our guide to creating a custom menu in WordPress for visitors instead.

How to Add a WordPress Custom Admin Menu With add_menu_page()

A WordPress custom admin menu is built with add_menu_page() inside a function hooked to admin_menu. The function takes a page title, menu title, capability, slug, callback, icon and position. WordPress then adds the item to the sidebar for every user who has that capability and shows your callback's output as the page.

Follow these steps:

  1. Decide where the code lives. Use a small custom plugin or a child theme's functions.php. Code in a parent theme is lost when the theme updates.
  2. Paste the code below and change the titles, slug and capability to fit your site.
  3. Save the file and reload any wp-admin screen. The new item appears in the sidebar.
  4. Log in as a lower role, such as Editor, to check that the right people see it.
1
2add_action( 'admin_menu', 'acme_custom_admin_menu' );
3
4function acme_custom_admin_menu() {
5    add_menu_page(
6        'Client Guide',          // Page title
7        'Client Guide',          // Menu title
8        'edit_posts',            // Capability
9        'client-guide',          // Menu slug
10        'acme_client_guide_page',// Callback
11        'dashicons-book',        // Icon
12        3                        // Position
13    );
14
15    add_submenu_page(
16        'client-guide',          // Parent slug
17        'Video Tutorials',       // Page title
18        'Video Tutorials',       // Menu title
19        'edit_posts',            // Capability
20        'client-guide-videos',   // Menu slug
21        'acme_client_guide_videos'
22    );
23}
24
25function acme_client_guide_page() {
26    echo '<div class="wrap"><h1>Client Guide</h1><p>Welcome! Use the links below to update your website.</p></div>';
27}
28
29function acme_client_guide_videos() {
30    echo '<div class="wrap"><h1>Video Tutorials</h1></div>';
31}
32

The prefix acme_ keeps the function names unique, so they do not clash with other plugins. Replace it with your own short prefix.

WordPress admin sidebar with a custom Client Guide menu item added with add_menu_page
The new Client Guide item sits near the top of the sidebar with the book Dashicon, so clients find it right after they log in.

The callback decides what the page shows. Ours prints a heading and a welcome line, and on our test site we added a short list of common tasks below it. You can output any HTML, a form, or a set of links to the screens your client uses most.

Custom Client Guide page in the WordPress admin created with add_menu_page and a callback function
The page body comes from the callback function. Wrapping it in a div with the "wrap" class gives it the normal wp-admin spacing.

What each add_menu_page() parameter does

ParameterExampleWhat it controls
Page titleClient GuideThe browser tab title
Menu titleClient GuideThe text in the sidebar
Capabilityedit_postsWho sees the item. edit_posts covers Contributors and up; manage_options is for Administrators only
Menu slugclient-guideThe unique ID, used in the URL (admin.php?page=client-guide) and as the parent for submenus
Callbackacme_client_guide_pageThe function that prints the page content
Icondashicons-bookA Dashicons class, an image URL, or a base64 SVG
Position3Where the item sits in the sidebar (lower numbers are higher up)

You can browse every icon class in the official Dashicons library. The full parameter list is in the add_menu_page() reference on developer.wordpress.org.

How to Add a Submenu With add_submenu_page()

To add a submenu, call add_submenu_page() in the same admin_menu function. Its first argument is the parent slug. Use your own slug, such as client-guide, to build a group of pages. Use a core file name, such as tools.php or options-general.php, to add a page under Tools or Settings.

In the example above, "Video Tutorials" becomes a child of Client Guide. A few things to know:

  • When a top-level item has submenus, WordPress repeats the parent as the first submenu item. To give it a different label, add a submenu with the same slug as the parent.
  • Submenu items have no icon. Only top-level items show one.
  • Each submenu needs its own capability. A user who cannot see the parent will not reach the child through the sidebar.

To place a page under Settings, change the parent slug to options-general.php and the capability to manage_options. WordPress also has shortcut functions, such as add_options_page() and add_management_page(), that set the parent for you.

The position number decides where your item appears. WordPress core uses fixed numbers for its own items, so pick a number between two of them. For example, 26 puts your item just after Comments, and 81 puts it after Settings. If you leave the position empty, the item goes to the bottom.

PositionCore item
2Dashboard
4Separator
5Posts
10Media
20Pages
25Comments
59Separator
60Appearance
65Plugins
70Users
75Tools
80Settings
99Separator

Plugins also pick numbers, so two items can ask for the same slot. Test the result after you install new plugins, and change your number if the item moves.

How to Add a Menu to the Network Admin on Multisite

The admin_menu hook only adds items to each single site's dashboard. For the network admin on a multisite install, use the network_admin_menu hook instead. The add_menu_page() arguments stay the same, but the capability should be one that network admins have, such as manage_network_options.

1
2add_action( 'network_admin_menu', 'acme_network_menu' );
3
4function acme_network_menu() {
5    add_menu_page(
6        'Network Guide',
7        'Network Guide',
8        'manage_network_options',
9        'network-guide',
10        'acme_client_guide_page',
11        'dashicons-networking'
12    );
13}
14

If you want the same page in both places, hook the function to both admin_menu and network_admin_menu, because each hook only fills its own dashboard.

How to Change Existing Admin Menu Items Without Code

A menu editor is faster than code for items that already exist. The Adminify Admin Menu Editor lists every wp-admin item, including ones added with add_menu_page(). You drag items to reorder them, rename them, change their link or icon, add a separator, and hide them for chosen roles or users.

WP Adminify Menu Editor list of WordPress admin menu items with drag handles
Our custom Client Guide item shows up in the Menu Editor list next to Dashboard and Posts, so you can move or hide it like any core item.
  1. Go to Adminify > Admin Menu and open the Menu Editor.
  2. Drag an item by its handle to move it up or down the sidebar.
  3. Click an item to expand it. The Settings tab has Rename as, Hidden For Roles or Users, Change Link, Set Custom Icon, New Window? and Add Separator.
  4. Use the Submenu tab to change the child items under that parent.
  5. Save, then check the sidebar as a lower role.

The Add Separator option puts a visual gap in the sidebar so you can group related items, for example your client pages apart from plugin settings. To hide clutter for clients, see how to remove and reorder admin menu items.

The Menu Editor works on items that already exist. For a brand-new admin page without code, Adminify has a separate Admin Pages module in the WP Adminify productivity tools. Its settings describe it as custom admin pages for a top-level or sub-level menu, built with Gutenberg or a page builder such as Elementor, Bricks, Oxygen or Divi. See WP Adminify Custom Admin Pages for what it can build, or our walkthrough on how to create a custom admin page in WordPress.

Custom Admin Menu Not Showing? Common Fixes

If your new item does not appear, the cause is almost always the capability, the hook, or where the code lives. Check that the current user has the capability you set, that the function runs on admin_menu, and that the file holding the code is active. Then clear any page cache and reload wp-admin.

  • The capability is too strict. manage_options hides the item from everyone except Administrators. Use edit_posts if Editors and Authors need it.
  • The code is in a theme. Code in a theme's functions.php stops running when you switch or update that theme. A small custom plugin avoids this.
  • Two items with the same menu slug overwrite each other. Use a unique, prefixed slug.
  • A menu editor hides it. If a plugin hides items by role, check its settings for your new item.
  • If the sidebar is collapsed and shows only icons, click Collapse menu at the bottom to expand it again. WordPress stores this choice per user.

For other causes, such as a broken plugin or missing user role, see our fixes for when the WordPress admin menu is not showing.

Frequently Asked Questions

What does add_menu_page do in WordPress?

add_menu_page() registers a new top-level item in the wp-admin sidebar. You give it a page title, menu title, capability, slug, callback function, icon and position. WordPress then shows the item to users with that capability, and the callback prints the content of the page when they click it.

What is the difference between add_menu_page and add_submenu_page?

add_menu_page() creates a top-level item with its own icon. add_submenu_page() creates a child item under a parent slug, which can be your own top-level item or a core screen such as tools.php or options-general.php. Both must run inside a function hooked to admin_menu.

Where should I put add_menu_page code?

Put it in a small custom plugin or in a child theme's functions.php file. A custom plugin is safer because the menu keeps working if you change themes. Avoid editing a parent theme directly, because a theme update will remove your code and the menu item will disappear.

Can I add a brand-new item with the WP Adminify Menu Editor?

The Menu Editor in WP Adminify 4.3.4 changes the items that already exist: rename, change link, change icon, reorder, add a separator and hide by role or user. To add a new page, use add_menu_page() in code or the Admin Pages module on the Productivity tab.

How do I expand a collapsed WordPress admin sidebar?

Click Collapse menu at the bottom of the sidebar to switch between the full menu and the icon-only menu. WordPress saves this per user, so it does not change what other users see. The sidebar also folds up on its own on narrow screens, such as tablets.

Final Thoughts

To add a menu to the WordPress admin dashboard, use add_menu_page() on the admin_menu hook for a new top-level item, add_submenu_page() for child items, and network_admin_menu on multisite. Pick the capability with care, since it decides who sees the item. Keep the code in a small plugin so it survives theme changes.

For everything that is already in the sidebar, our guide to the WordPress Admin Menu editor shows how to reorder and hide items by role. When you are ready to set it up on client sites, compare the WP Adminify plans.

Get notified about Updates & Offers

Subscribe to get Updates & Offers

You Might Also Like:

Coupons