+
+/**
+ * Remove a top level admin menu
+ *
+ * @since 3.1.0
+ *
+ * @param string $menu_slug The slug of the menu
+ * @return array|bool The removed menu on success, False if not found
+ */
+function remove_menu_page( $menu_slug ) {
+ global $menu;
+
+ foreach ( $menu as $i => $item ) {
+ if ( $menu_slug == $item[2] ) {
+ unset( $menu[$i] );
+ return $item;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Remove an admin submenu
+ *
+ * @since 3.1.0
+ *
+ * @param string $menu_slug The slug for the parent menu
+ * @param string $submenu_slug The slug of the submenu
+ * @return array|bool The removed submenu on success, False if not found
+ */
+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;
+}
+