WPDev.one
Core Function
View Source on Trac ↗

add_menu_page()

add_menu_page( mixed $page_title, mixed $menu_title, mixed $capability, mixed $menu_slug, mixed $callback = '', mixed $icon_url = '', mixed $position = null )

Adds a top-level menu page.

Parameters 6 required

Name / Type Description
$page_title
string

The text to be displayed in the title tags of the page when the menu is selected.

Required
$menu_title
string

The text to be used for the menu.

Required
$capability
string

The capability required for this menu to be displayed to the user.

Required
string

$menu_slug The slug name to refer to this menu by. Should be unique for this menu page and only include lowercase alphanumeric, dashes, and underscores characters to be compatible with sanitize_key().

Required
$callback
callable

Optional. The function to be called to output the content for this page.

string

$icon_url Optional. The URL to the icon to be used for this menu. * Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme. This should begin with 'data:image/svg+xml;base64,'. * Pass the name of a Dashicons helper class to use a font icon, e.g. 'dashicons-chart-pie'. * Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS.

Required
(int

| float) $position Optional. The position in the menu order this item should appear.

Required

Return Value

(string)
The resulting page's hook_suffix.

Function Information

Since Version
1.5.0
Source File
wp-admin/includes/plugin.php
Advertisement