WordPress at a glance

remove_submenu_page() WP 1.0

Remove an admin submenu.

  • Global. Array. $submenu

No Hooks.

Return

Array/true/false. The removed submenu on success, false if not found.

Usage

remove_submenu_page( $menu_slug, $submenu_slug );
$menu_slug(string) (required)
The slug for the parent menu.
$submenu_slug(string) (required)
The slug of the submenu.

Code of remove_submenu_page: wp-admin/includes/plugin.php VER 4.9.8

<?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;
}

Related Functions

From tag: WP minimize (minimise reduce mitigate diminish lessen)

More from tag: Admin menu (admin panel)

No comments
    Hello, !     Log In . Register