WPSEO_Base_Menu::register_menu_page
Registers a submenu page as a menu page.
This method should only be used if the user does not have the required capabilities to access the parent menu page.
Метод класса: WPSEO_Base_Menu{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->register_menu_page( $submenu_page );
- $submenu_page(массив) (обязательный)
Submenu page definition.
-
0(строка)
Parent menu page slug. -
1(строка)
Page title, currently unused. -
2(строка)
Title to display in the menu. -
3(строка)
Required capability to access the page. -
4(строка)
Page slug. -
5(callable)
Callback to run when the page is rendered. - 6(массив)
Optional. List of callbacks to run when the page is loaded.
-
Код WPSEO_Base_Menu::register_menu_page() WPSEO Base Menu::register menu page Yoast 27.6
protected function register_menu_page( $submenu_page ) {
// If the submenu page requires the general manage capability, it must be added as an actual submenu page.
if ( $submenu_page[3] === $this->get_manage_capability() ) {
return;
}
$page_title = 'Yoast SEO: ' . $submenu_page[2];
// Register submenu page as menu page.
$hook_suffix = add_menu_page(
$page_title,
$submenu_page[2],
$submenu_page[3],
$submenu_page[4],
$submenu_page[5],
$this->get_icon_svg(),
99,
);
// If necessary, add hooks for the submenu page.
if ( isset( $submenu_page[6] ) && ( is_array( $submenu_page[6] ) ) ) {
$this->add_page_hooks( $hook_suffix, $submenu_page[6] );
}
}