i also had this problem. the problem is that you are adding action to *admin_init* … try something like this:
add_action( 'admin_menu', 'remove_unused_menus' );
function remove_unused_menus() {
remove_menu_page('link-manager.php');
remove_menu_page('edit-comments.php');
}
notice the use of *admin_menu* instead of *admin_init*
some require admin_init…but i forget which/why.
Related Posts:
- How to Hard Code Custom menu items
- Removing container from wp_nav_menu not working
- Check if page is in a certain menu
- Increase search results for Admin -> Appearance -> Menus -> Search (default is 10)
- Is it possible to add classes to list items in wp_nav_menu()?
- How do I add the data-toggle=”modal” data-target=”#myModal” attribures to a WP Nav bar?
- How do I fix this error: Warning: invalid argument supplied for foreach()?
- Exclude one item from wp_list_pages( $args );
- Page not appearing in navigation bar
- Extend WordPress REST API to show slugs for menu items
- WordPress Custom Menu Widget Style
- Output menu navigation in php file
- Custom Post type menu highlighted in the archive/post
- display only the wp_nav_menu, which has the current-menu-item
- Unclickable Menu Item Label in Custom Menu with Clickable Children
- Add tabindex to navmenu
- wp_list_pages sort order is different for different languages [closed]
- Remove Metabox from Menus screen
- Sort wp_nav_menu() by menu order
- How to have custom menu Item CSS Classes for wp_page_menu() or wp_list_pages()
- How can I add a link to a WPForms “contact us” form to the main menu?
- How to fix “Supplied nav_menu_item value missing property” after update to WordPress 5.0
- How to add programmatically all pages and children to backend menu
- View h2 content tags of a page in sub menu
- Separator for custom nav menu
- add_submenu_page function to show videos table
- Menu item with no page, but with dropdown
- How do I add recent posts to the menu?
- Conditional secondary menus
- Create a MegaMenu using a walker and the start_lvl function
- Nav and logo loading each time causing menu to move JointsWP – Foundation 6
- WordPress Plugin menu position overwrite other item
- Creating a menu containing categories and authors
- Change submenu markup
- Get page slug/id from position in menu
- Two different “Home” items in custom menus dashboard section
- How to use a start_el variable in start_lvl
- list category posts under its item in menu
- How to re-arrange the MENU of “Allure Real Estate Theme for Placester” wordpress theme?
- Using _s theme, menu changes do not affect header menu
- Change class-name on “current_ancestor” in wp_nav_menu
- styling wp_nav_menu – horizontal, sub-menu drop downs
- Show children (sub-navigation) of active menu item only
- Highlighting top level link when viewing one of it’s sub-pages, which are not linked in the menu
- Make menu items open in new tab/page
- Adding top level items in the admin menu that link to a post
- How do I hide “Pages”, “Media”, “Comments”….for editor role?
- how to change the color of menu text wordpress?
- Need a menu on left sidebar of the page with below requirements [closed]
- add login menu with submenu
- Walker Class: Output Parent Description and Featured Image right after sub-menu?
- How to make top level menu think it has a current item
- Generate Navbar In WordPress
- Showing home button in a specified menu
- Odd spacing in Navigation Bar [closed]
- An alternative to WordPress’s built-in menu functionality
- Registering a static menu?
- Add session or cookie to remember last menu location
- Is there any way to change the CSS class applied to 2nd level sub menu ul’s?
- wp_nav_menu removing containing UL with ‘items_wrap’ => ‘%3$s’ not working
- How to show only current item children using wp_nav_menu?
- Option to create menu is missing
- New menu is not showing in api response
- Newly created header is not visible on website
- Event listener callback returns undefined element
- Copied site has wrong menu URL behaviour
- Add CSS Class to WordPress Menu Item Dependent on the Page the User is Visiting
- Menu walker: how to tell if a sub menu contains submenus?
- Sub Menus will not work
- Walker or wp_get_nav_menu_items VS jQuery
- I can’t correctly display menu
- WPML CMS Nav and Custom Nav_Walker Undefined Property Notices [closed]
- Is it possible to seperate wordpress menu by different div?
- How to add odd and even classes to all nav links through walker?
- Output sort number in wp menu list item?
- Primery Menu Configuration problem
- how to display wordpress navbar with top menu outside wordpress system
- Disappearing items in menu
- Menu not saving in dashboard
- Menus not showing in the admin menu, after save
- Customize Walker_nav_menu to show posts if item is category
- Where these arguments are defined?
- How do i keep my current page menu highlighted on pagination?
- Add Protocol to Custom Menus
- WordPress Flyout Menus
- Pick out specific menu item from code
- Show All Children of WordPress Menu
- menu doesn’t show in different languages
- How to make an anchored page in a navigation menu tab
- Change menu item order
- Menu System: Custom Links
- highlight parent page on menu when child page is on sidebar (and not on menu)
- nav tag wrapping around dropdown
- Resolve the debugs
- Formatting WordPress Menus (without bullets, inline with text)
- Active Navigation Class Based on URL on icon
- Rename Menu icon in Twenty seventeen theme
- WordPress Menu – Adding a new dynamic element to the menu
- One item on menu is not clickable when it should be
- Critical Error when editing menu