Codex tools: Log in
Contents |
Remove an admin submenu.
Please be aware that this would not prevent a user from accessing these screens directly. Removing a menu does not replace the need to filter a user's permissions as appropriate.
<?php remove_submenu_page( $menu_slug, $submenu_slug ); ?>
Removes the Widgets submenu page.
<?php
add_action( 'admin_menu', 'adjust_the_wp_menu', 999 );
function adjust_the_wp_menu() {
$page = remove_submenu_page( 'themes.php', 'widgets.php' );
// $page[0] is the menu title
// $page[1] is the minimum level or capability required
// $page[2] is the URL to the item's file
}
?>
In the above example, the value of $page would have been:
array(3) { [0]=> string(7) "Widgets" [1]=> string(18) "edit_theme_options" [2]=> string(11) "widgets.php" }
Since: 3.1.0
remove_submenu_page() is located in /wp-admin/includes/plugin.php.
Administration Menus: add_menu_page(), remove_menu_page(), add_submenu_page(), remove_submenu_page(), add_dashboard_page(), add_posts_page(), add_media_page(), add_links_page(), add_pages_page(), add_comments_page(), add_theme_page(), add_plugins_page(), add_users_page(), add_management_page(), add_options_page()