Use the API functions remove_menu_page
and remove_submenu_page
to remove menu items rather than manipulating global variables.
This will remove the themes page under appearance:
function wpa_remove_themes_submenu() {
remove_submenu_page( 'themes.php', 'themes.php' );
}
add_action( 'admin_menu', 'wpa_remove_themes_submenu', 999 );
Related Posts:
- WordPress Quick Question . How to Get Parent Link in Submenu in My Code
- How I can add div to menu?
- Mega Menu Walker
- start_lvl Ignored in Custom walker_nav_menu
- Displaying Logged-In User Name in WordPress Menu
- Hide main div if wp_nav_menu is empty
- Check if a menu is empty?
- renaming an admin menu item with decimal array index number
- How to remove a metabox from menu editor page?
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- How to add active class to custom menu using while loop and wp_list_pages
- WordPress menu deletes when trying to add a hook
- Logout and redirect using the WP Menu
- Logout hyperlink within a sub-menu
- Create Logout Link WordPress Admin Menu
- Have CSS Class Added with `is_page()` WP function
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Run a filter when a walker runs
- How to display conditional-content if wp_nav_menu( $args ) retruns something
- Menu — How to add “current-menu-grand-ancestor” css class
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Automatically adding new post categories to menu
- Add data attribute to each li in menu
- Unique icons next to each WordPress menu item
- Child page menu in sidebar
- Title Case WordPress Menu Items
- Detecting classes, adding widgets, and adding divs in with a Nav Walker
- How to change menu order item
- get_the_title() gets printed out twice
- Add item to top of menu using a filter in functions.php
- Register a menu – Error Header
- Add login hyperlink to secondary navigation menu
- how to save checkbox data for custom setting?
- Add value to new attribute inside WordPress menu items
- Get the name of menu item with wp_nav_menu
- How to use wp_nav_menu to create custom dropdown menu?
- How to add aria role and schema markup to custom walker container
- How can I use custom menus with a Bootstrap WordPress theme?
- Nav-Menu not showing up
- Show login greeting above sub-menu links?
- Dynamic Menu drops pages?
- Menu not styling. New menus functionality giving me a headache
- how to changes mobile menu toggle breakpoint in WordPress
- How to display already created menus via php?
- Providin exception to WordPress wp_nav_menu Custom CSS Classes
- How to put 2 php codes in functions.php without site crashing
- Menu not updating for logged in users after redirect
- Get Child of Child Pages in custom Menu
- Add element after navigation element title don’t works like I expect
- Add parent menu item in sub-menu in custom nav_walker
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Display specific main Sub Nav on Woocommerce product pages
- Pulling a variable into the wp_nav_menu function
- Beyond widget side menu editing, with the php page, custom template
- wp_nav_menu prints children with parent name
- WP Admin Bar – Get current theme name as custom menu title
- How to call a certain object/menubar in a PHP file
- WordPress adding in site URL to header links
- Can’t remove menu items added by plugin
- Submenu opened problem
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- How to add different menu items on different menus?
- How to access admin menu labels and links on front-end?
- How can I alter this code to accept a slug as well as an ID?
- Deactivate a plugin on wp version
- how to add a div inside wp_page_menu
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- WordPress theme showing blank page
- Enqueueing a code block from an options framework
- Include a file that has a function in it
- Why in this WordPress theme I can’t see the Main Menu?
- Execute Jquery when a specific page in my plugin is loading
- Unable to add extra elements to the main navi (wp_nav_menu_items)
- Conditional On custom field plugin metabox
- Why can’t I add a custom image in my navigation?
- get_template_part function and add images
- Displaying Slider in Front Page (home) using Customizr Theme
- How can I assign separate stylesheets to different pages?
- Need advice on theme customizer and child themes
- How to make sure relative URL works when site is not on root domain?
- How to add PHP pagination to wordpress
- How to pass hook variable to function?
- Get the alt text of the image in a array
- Admin Menu new tab external link
- How to prevent a function from running based on host (ie web vs local)?
- call a string/function from database
- conditional: if is page, and all subpages
- wp nav menu: show submenu below li item
- How to tell if a user has gone in and created a menu
- How to call custom function outside from the admin page?
- making php value numeric
- Strip from or something better?
- Add a select-option to the default widgets
- Defining multiple categories for showing latest posts
- the_post_thumbnail issues
- Is there a way to create a “copy post” link?
- Some problems calling a function into sprintf() inside functions.php template file [closed]
- Display additional page templates and a sidebar on plugin activation
- Adding a ‘style=’ bit to image_send_to_editor output