remove_submenu_page
Remove an admin submenu.
Description
Returns (array|bool)
The removed submenu on success, false if not found.
Parameters (2)
- 0. $menu_slug (string)
- The slug for the parent menu.
- 1. $submenu_slug (string)
- The slug of the submenu.
Usage
if ( !function_exists( 'remove_submenu_page' ) ) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; } // The slug for the parent menu. $menu_slug = ''; // The slug of the submenu. $submenu_slug = ''; // NOTICE! Understand what this does before running. $result = remove_submenu_page($menu_slug, $submenu_slug);
Defined (1)
The function is defined in the following location(s).
- /wp-admin/includes/plugin.php
- function remove_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] ) {
- unset( $submenu[$menu_slug][$i] );
- return $item;
- }
- }
- return false;
- }