You can use this code
add_action('adminmenu', function() {
?>
<script>
jQuery('#adminmenu .wp-has-current-submenu.wp-menu-open')
.removeClass('wp-has-current-submenu')
.removeClass('wp-menu-open')
.addClass('wp-not-current-submenu');
</script>
<?php
});
Related Posts:
- Adding all sub-pages to the menu manager
- how to hard link to the posts page?
- How to remove admin menu pages inserted by plugins?
- Remove wrapping div and ul from output of wp_nav_menu
- How to use more than 256MB of memory in the admin?
- Add separator to admin submenu
- Show a WP 3.0 Custom Menu in an HTML Select with Auto-Navigation?
- global menus made from master site’s custom menus wpmu network
- Widgets not working in Customizr but working in Appearance
- How to build custom WP admin with custom URLs
- WordPress prompt checklist before publish?
- Make Theme automatically choose default nav menu
- Get the sidebar ID in which the current widget was dropped
- wordpress custom walker for thumbnails with custom menu
- How to exclude certain widget from showing up on home/front page? [duplicate]
- Adding an email column to a Custom Post Types Admin Screen?
- Change default status and replace the icon for an hamburger menu
- simple expandable vertical menu, java script problem
- How to translate month names in “Archives”
- Create a Custom menu item fetched by Product Categories and Sub Categories
- Custom Dashboard Home Screen Options
- register_sidebar ‘after_widget’ on custom-built widgets not implementing, caused nested widgets
- Best practices: Custom theme sidebar menu – hardcode or widget?
- wp_nav_menu google analytics event tracking
- Only append custom classes to nav menu items
- Add custom column to Users admin panel with Types user custom fields?
- Count widgets of a certain type
- Hide Login information in Account settings in Buddy Boss
- Change HTML structure for custom menu in sidebar
- Hide upload image fields for the different media upload popups
- How can I get the page url slug when ‘post_name’ returns an id?
- Custom Admin Menu Order
- Sidebar links for different pages
- Preserve custom URL parameter after saving post
- add JS to multiple plugin admin pages
- Putting tag outside tag on generated Menu
- Programmatically (PHP) get the nr. of items in the primary navigation menu
- Function to remove archive sidebar for custom taxonomy?
- Hard-coding custom menu elements for menu manager
- How to create left and right menu with logo center in a custom theme?
- Add clickable arrows to parent menu items with children elements e.g. with
- How Do I Remove The Right Hand Block On The Main Header?
- How to get custom page template being edited in gutenberg editor
- Adding posts to custom menu [closed]
- How to wrap the list with custom class using wp_nav_menu?
- Alphabetical Custom Menu
- Sub menu indicator that links to sub menu
- Organizing the position of widgetized areas in the backend
- Looking replicate static HTML Menu into WordPress Dynamic Menu [closed]
- Customizing Users in Admin Area
- Data won’t save if metabox within conditional in admin. What am I missing?
- Simplify the admin end
- Insert menu with a custom walker into page / post body using shortcode?
- Implement a Walker with custom object rather than WordPress database object
- How to create “custom page types” with different custom fields in them?
- How can I tag a menu item as visited for each unique user?
- Position a hard-coded menu item
- How can i create menu like in the example?
- WordPress custom dropdown listings
- How to append custom text to the output of ‘categories widget’?
- How to request container_class from wp_nav_menu
- Menu not appearing in custom theme
- How can i display custom menu in sidebar?
- How to have multiple WordPress Menus
- How to add active state to the navigation links?
- Usage of custom post types in a custom admin menu
- Dynamic Sidebars based on page name
- Customize Widget Navigation
- Custom menu not showing even though it shows as being registered?
- Select input in metabox not updated
- Custom CSS Nav Menu Style Not Being Applied
- Current menu item highlights wrong
- Add producthunt badge to wordpress menu
- Woocommerce custom “My Account” Tab – Add Save button
- How to create custom backend admin menu in different languages?
- remove screenshot.png via dashboard
- How to add a template – so that i can choose a different menu for some pages
- Adding more than one WordPress Gutenburg block type?
- clickable toggle menu, help
- How to create custom post type selection to nav menu
- How to narrow the area between buttons on Helium theme sidebar? [closed]
- Help needed creating a custom Hamburger menu in header
- Menu selection for header
- How to create a custom menu for specific user
- Creating a dynamic URL for an external link inside content
- remove or hide Link Relationship (XFN) form Menus tab
- My connecting URL form in html to PHP does not work
- User WordPress menu in custom page
- Adding images to anchors in the list created and fetched with wp_nav_menu
- Admin menu disable new/delete page
- Buddypress: New Tab and Page (Members Profile) [closed]
- How to work around the bug which prevents custom menus from being deleted?
- Class .current-menu-item in custom menu Walker
- Adding pages to the Admin panel
- Customize Admin Section
- How to create functions that affect only a specific user
- Create users via PHP
- How do I include the sidebar (with Widgets) in a custom theme?
- Custom CSS File wont work on second Page
- removing extra mobile menu from the header