WPSEO_Base_Menu::register_menu_page()protectedYoast 1.0

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. Ничего.


// 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() Yoast 19.11

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() ) {

	$page_title = 'Yoast SEO: ' . $submenu_page[2];

	// Register submenu page as menu page.
	$hook_suffix = add_menu_page(

	// 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] );