WC_Admin_Menus::hide_submenu_page()
Hide the submenu page based on slug and return the item that was hidden.
Borrowed from Jetpack's Base_Admin_Menu class.
Instead of actually removing the submenu item, a safer approach is to hide it and filter it in the API response. In this manner we'll avoid breaking third-party plugins depending on items that no longer exist.
A false|array value is returned to be consistent with remove_submenu_page() function
Метод класса: WC_Admin_Menus{}
Хуков нет.
Возвращает
false|Массив
.
Использование
$WC_Admin_Menus = new WC_Admin_Menus(); $WC_Admin_Menus->hide_submenu_page( $menu_slug, $submenu_slug );
- $menu_slug(строка) (обязательный)
- The parent menu slug.
- $submenu_slug(строка) (обязательный)
- The submenu slug that should be hidden.
Код WC_Admin_Menus::hide_submenu_page() WC Admin Menus::hide submenu page WC 9.4.2
public function hide_submenu_page( $menu_slug, $submenu_slug ) { global $submenu; if ( ! isset( $submenu[ $menu_slug ] ) ) { return false; } foreach ( $submenu[ $menu_slug ] as $i => $item ) { if ( $submenu_slug !== $item[2] ) { continue; } $this->hide_submenu_element( $i, $menu_slug, $item ); return $item; } return false; }