WordPressadd_menu_page()


Introduction

This function is to add an item in the admin panel's nav bar.

Syntax

  • add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position)

Parameters

ParameterDetails
$page_title(string) The text to be displayed in the title tags of the page when the menu is selected.
$menu_title(string) The text to be used for the menu.
$capability(string) The capability required for this menu to be displayed to the user.
$menu_slug(string) The slug name to refer to this menu by (should be unique for this menu).
$function(callable) (optional) The function to be called to output the content for this page.
$icon_url(string) (optional) The URL to the icon to be used for this menu.
$position(int) (optional) The position in the menu order this one should appear.

Remarks

Here is a list of the default positions (for $position)

  • 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