About add_menu_page () function


This function takes a capability which will be used to determine whether or not a page is included in the menu.The function which is hooked in to handle the output of the page must check that the user has the required capability as well.
Return: (string) The resulting page’s hook_suffix.add_menu_page() accept 7 parameters.

  1. $page_title (string) (Required)
  2. $menu_title (string) (Required)
  3. $capability (string) (Required)
  4.  $menu_slug (string) (Required)
  5. $function (callable) (Optional)
  6. $icon_url  (string) (Optional)
  7. $position (int) (Optional)

About Parameters :->

  1. $page_title    :->   The text to be displayed in the title tags of the page when the menu is selected.
  2. $menu_title   :->   The text to be used for the menu.
  3. $capability    :->   The capability required for this menu to be displayed to the user.
  4. $menu_slug  :->   The slug name to refer to this menu by (should be unique for this menu).
  5. $function      :->   The function to be called to output the content for this page.
  6. $icon_url       :->  The URL to the icon to be used for this menu.
  7. $position       :->  The position in the menu order this one should appear.

    Default value: null