WordPress at a glance

remove_submenu_page() WP 1.0

Remove an admin 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.

Notes

  • Global. Array. $submenu

Changelog

Since 3.1.0 Introduced.

Code of remove submenu page: wp-admin/includes/plugin.php WP 5.2.2

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