Not without touching the global $submenu
directly (which I wouldn’t recommend – using only purposefully exposed APIs provides, in general, better stability).
However, if you wanted a function to remove all submenus:
/**
* Removes all submenus of given menu item
*
* @param string $menu_slug The slug of the parent menu to remove submenus of
*/
function wpse137406_remove_submenus( $menu_slug ) {
global $submenu;
if ( isset( $submenu[$menu_slug] ) ){
unset( $submenu[$menu_slug] );
}
}
Related Posts:
- How to Add a Third Level Sub Menu to the WordPress Admin Menu
- Is There a WordPress Hook to Filter the Edit Posts View?
- Add section (add_settings_section) to a custom page (add_submenu_page)
- How to remove duplicate sub-menu name for top level menu items in a plugin?
- How do I only load a plugin js on it’s settings pages?
- Custom plugin settings: clicking “save changes” does not display success message
- All Users > User List > Update User Meta Field Inline
- Display update notification messages like ‘What’s New’
- How to set add question capability for author role in wp pro quiz plugin
- do_action() hook into load-(page)
- How to change the name of the “edit my profile” link in the WordPress admin backend
- Adding CSS to custom post type admin page causes error
- Admin AJAX doesn’t work in plugin admin page – Even though code is copied verbatim from WordPress Codex
- creating a plug in that would tap into save/update action of posts [closed]
- How to use the CSS of the WordPress core in the development of my administration page?
- Ajax request sends url rather than data
- How to add captcha to publish widget
- Adding a jQuery modal dialog to the admin area
- How to create admin setting for this small plugin
- WC Fix Attributes – ‘Add New’ Not Searchable/Delayed
- Hide all Admin Notices and move on a separate page
- Echo custom admin field into a is_single()
- Get content and send to 3rd party
- Display Any Field fromAdmin Panel in Frontend via Shortcode?
- Pass PHP variable to javascript
- How can I log a user out of WordPress before the page loads?
- wordpress get meta value by meta key
- What areas to Unit test while building a plugin?
- Bad Request (Invalid Hostname) on working server, database problem
- update_meta_user difference in i:1 and b:1, how to write b:1
- Registration Form Validation in wordpress
- Errors while using ajax from external wordpress page
- Dequeue / Deregister script and replace it with a new plugin
- Hide Theme options and Customize Admin menu
- Current user in plugin returns NULL
- wordpress reusable content blocks
- How can I implement a notification system in wordpress?
- Building an email signup form. Where should the information be saved in the DB?
- How to make a customize role and view a specific plugins base on that role?
- Editing admin pages in WordPress [closed]
- Custom form action to handle data inside a plugin
- WP Post Template – Templates in own folder
- Is this the right way to execute some PHP in my plugin after a button click on an options page?
- Create entire wordpress as a github repositery?
- Map Custom Registration Fields to WordPress User Roles
- custom payment gateway in woocommerce failed to connect to remote api server
- Plugin options page with live preview?
- Ajax call returning 0
- How to update post’s content on post publish?
- WordPress plugin admin html being shown in Customizer iframe
- WordPress Widget – Saving multidimensional arrays into $instance
- Ordering taxonomies by rank
- Plugin Options not being output
- Can I create a table on my DB without creating a plugin?
- Submit Form data to another page via Ajax (WordPress Way)
- WordPress checkbox and Illegal string offset
- Custom Login Page — wp_signon Headers Already Sent?
- Add User Role: Pre-saved in User-Meta [SOLVED]
- Add_rewrite_endpoint doesn’t work with post name permalink structure
- Why is my WordPress Plugin page requesting my FTP Login Credentials?
- Cross Sells are not being shown in Cart Page. Please Help!
- Plugin not properly prepared for localization
- adding custom code as a wordpress plugin
- How To Create A File Archive in WordPress?
- Gathering all Custom Post Type posts in to array/object the proper way
- Custom Post Type, Custom Columns List
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- How to upload large media file in chunks, without any plugin?
- How to set Google Analytics tracking code on WordPress plugin directory page?
- How to add styles to a submenu page?
- How to store a secret for a plugin inside public_html
- Problem with checked box on wp car manager plugin
- How to use functions found inside pluggable.php with my plugin files
- Create a link that calls our custom function in WordPress
- Update a previous version of plugin when the new plugin is built from the scratch
- Woocommerce list variations that are added already to cart in Single Product
- Plugin json page
- How do I add a textarea (multirow) option to my WordPress plugin?
- Passing ajax variable to more than one wordpress plugin function
- search into subcategories plugin subcategory value not come
- How to enable Admins to see Plugins
- Why isn’t my plugin seeing other classes?
- How Can the_post Be Hooked Like the_content and the_excerpt?
- How to tell which Plugin is displaying?
- Get Core Functionality from Within a (Secondary) Plugin File
- wp_insert_post_data filter to set category
- is there a way I can add or remove some plugin options?
- What is the recommended way to be notified of security updates to my plugins? [closed]
- How to provide access to specific plugin to all the user roles except subscriber in wordpress
- Output pure JSON wordpress
- how to remove a rel=”nofollow” using call to action plugin
- Activate plugin button do nothing [closed]
- add_meta_box showing blank screen in my page
- is_user_logged_in() undefined at shutdown in plugin context
- What are Seeds? [closed]
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- Plugin translations are not loaded from translate.wordpress.org
- Use inline callable for hooks and filters
- Error in using ‘admin_enqueue_scripts’ action through a class
- How do i fix this error?