Create WordPress admin menu for your plugin

If you create a WordPress plugin, you want to allow users to change settings from the WordPress dashboard. Adding a WordPress admin menu lets you allow users to customize your plugin to fit their needs.

At this point in your WordPress plugin development, you should already have started to create the WordPress plugin function to control what your plugin does.

Remember, you can get speed and security on your site by simply trying out a dedicated WordPress Hosting plan. Built from scratch to provide the best possible WordPress experience.

Create WordPress admin menu link

To make your WordPress plugin settings easily accessible, it’s best to create an admin menu in the dashboard. This menu should have fields where users can customize your plugin to fit their exact needs.

Use the WordPress function add_action along with admin_menu to let WordPress know we’re building an admin menu. Then pass the function name of your menu extra_post_info_menu that sets up your menu item.

add_action( 'admin_menu', 'extra_post_info_menu' );  function extra_post_info_menu(){    $page_title = 'WordPress Extra Post Info';   $menu_title = 'Extra Post Info';   $capability = 'manage_options';   $menu_slug  = 'extra-post-info';   $function   = 'extra_post_info_page';   $icon_url   = 'dashicons-media-code';   $position   = 4;    add_menu_page( $page_title,                  $menu_title,                   $capability,                   $menu_slug,                   $function,                   $icon_url,                   $position ); } 
Variable nameDescription
$page_titleThe title shown in the web-browser when viewing your plugin page
$menu_titleThe title for the menu button shown in the WordPress dashboard
$capabilitymanage_options allows only Super Admin and Administrator to view plugin
$menu_slugURL to access plugin such as: /wp-admin/admin.php?page=extra-post-info
$functionThe function that contains the code for what to actually display on your plugin page
$icon_urlIcon used in dashboard. You can use WordPress dash icons, or direct images like: $icon_url = plugins_url( ‘extra-post-info/icon.png’ );
$positionIcon position in dashboard


WordPress position numbers:

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




Function nameDescription
add_menu_pageThe WordPress function that hooks in and builds our plugin menu in the dashboard

Blank plugin page accessed from dashboard menu

At this point you should be able to see your WordPress plugin menu in the dashboard. If you click on it, you’re just going to get a blank page as you haven’t told WordPress what to put here yet.

extra post info plugin page blank

Create WordPress plugin page

Once your admin menu is made, the next thing you’ll want to do is create a WordPress plugin page.

Stormy Scott
Stormy Scott Content Marketing Writer

Stormy is a Content Marketing Writer at InMotion Hosting. Her content focus is WordPress, web design, and help articles for small businesses.

More Articles by Stormy

Thoughts on “Create WordPress admin menu for your plugin

Was this article helpful? Let us know!