You appear to be a bot. Output may be restricted
Description
Adds a new submenu to the Jetpack Top level menu
The parameters this method accepts are the same as @see add_submenu_page. This class will aggreagate all menu items registered by stand-alone plugins and make sure they all go under the same Jetpack top level menu. It will also handle the top level menu registration in case the Jetpack plugin is not present.
Usage
$string = Admin_Menu::add_menu( $page_title, $menu_title, $capability, $menu_slug, $function, $position );
Parameters
- $page_title
- ( string ) required – The text to be displayed in the title tags of the page when the menu is selected.
- $menu_title
- ( string ) required – The text to be used for the menu.
- $capability
- ( string ) required – The capability required for this menu to be displayed to the user.
- $menu_slug
- ( string ) required – The slug name to refer to this menu by. Should be unique for this menu and only include lowercase alphanumeric, dashes, and underscores characters to be compatible with sanitize_key().
- $function
- ( callable ) required – The function to be called to output the content for this page.
- $position
- ( int ) optional – The position in the menu order this item should appear.
Returns
string The resulting page's hook_suffix
Source
File name: jetpack/jetpack_vendor/automattic/jetpack-admin-ui/src/class-admin-menu.php
Lines:
1 to 11 of 11
public static function add_menu( $page_title, $menu_title, $capability, $menu_slug, $function, $position = null ) { self::init(); self::$menu_items[] = compact( 'page_title', 'menu_title', 'capability', 'menu_slug', 'function', 'position' ); /** * Let's return the page hook so consumers can use. * We know all pages will be under Jetpack top level menu page, so we can hardcode the first part of the string. * Using get_plugin_page_hookname here won't work because the top level page is not registered yet. */ return 'jetpack_page_' . $menu_slug; }