Use this example
function my_admin_bar_render() {
$user = wp_get_current_user();
if ( in_array( 'editor', (array) $user->roles ) ) {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('new-content');
}
}
add_action( 'wp_before_admin_bar_render', 'my_admin_bar_render' );
Related Posts:
- Changing the Order of Admin Menu Sections?
- Adding an Arbitrary Link to the Admin Menu?
- Add separator to admin submenu
- Renaming a WordPress Admin Menu
- How do I fix this error: Warning: invalid argument supplied for foreach()?
- How to add menu to Dashboard that can be viewed by all users
- Make Theme automatically choose default nav menu
- Move admin menu at the end
- Hide pages depending on role
- How to display custom post meta in the appearance->menus page
- How can I get an array/list of all current WordPress Admin Menu items?
- how to only add a top-level admin menu without it creating a sub-level-menu
- Remove Metabox from Menus screen
- Sort wp_nav_menu() by menu order
- Custom Admin Menu Order
- Disabling ‘posts’ in Appearance > Menus
- Hiding Admin Page While Keeping Menu Expanded
- Get admin menu link
- Hook for number of items in Appearance > Menus > CustomPostType > View All [duplicate]
- Filter for Admin Nav Menus Drop Down
- SlideDeck 2, make back-end visible for admins only
- Limit the menu child levels under “admin > appearance > menus”
- Ad custom admin page like WordPress customizer [closed]
- Admin menu structure
- Appearance Menus Screen – menu item drop down menu not functioning
- Adding an admin menu page showing the link twice – how to solve this?
- Admin-ajax.php 500 error when Add to menu is clicked in admin
- Can I have custom post types in “Add menu items” on in the Admin > Appearance > Menu
- Add Labels to Admin Menu ( How To )
- How can I make a menu link visible only to admins (without plugins)?
- Adding top level items in the admin menu that link to a post
- How to get submenu of admin menu?
- Strange menu behaviour wordpress admin [duplicate]
- Adding CSS-class to WordPress Menu in backend
- Menu deletes all items and position – wordpress bug?
- Plugins & Setting Menu Items Removed From Admin Panel
- add_menu_page does not render the expected result
- Admin Menu Hack (Left side in Dashboard)
- Lost admin “manage_link” capability WordPress. No “Links” menu item in admin menu
- Admin menu in different languages
- Need to remove the admin menu item from a be theme in wordpress
- Add category label for appearance > menus items
- Links in new menu don’t work
- wp_is_mobile() inside js
- Appearance > Menus
- Customizing label/title output of admin nav_menu selecter
- Is It Possible To A Link To The Homepage From The Admin Sidebar?
- Query for menus in backend (BE)
- List of WordPress menu item indices?
- How do I fix the URL used in the WordPress admin menu for customize.php
- How can I disable sorting/dragging of a menu item in the custom menu admin?
- How to change the markup created by menu item only on chosen items?
- How to change WP menu item type?
- Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl()
- remove last separator?
- renaming an admin menu item with decimal array index number
- WordPress built in breadcrumb trail menu?
- WordPress Export Import Site Navigation Menu
- Bar separated navigation by extending Walker_Nav_Menu
- how do I delete (not exclude) a menu item from navigation bar
- show only a given level in nav menu
- Custom menus created but does not show up in admin panel
- Replace menu tag with tag
- Does loading of sub pages in menu cause load to the server?
- Possible to add a dynamic link to a sub-menu via wp_nav_menu_items?
- How to have the Header show different content on different pages?
- WordPress menu not loading in the admin side appearence-> menu tab
- Is there no straightforward way to display a separate second level using wp_nav_menu()?
- Change the menu home link to something else
- wp_nav_menu $theme_location parameter ignored
- Make pages visible to only logged in members
- Insert a div before the wp_nav_menu
- How to create a menu with pages and post categories?
- remove specific classes from menu items
- how avoid the link of the current post in the menu in the sidebar?
- How to convert the argument of wp_list_pages to an array
- wp_bootstrap_navwalker Fatal Error
- wp_nav_menu returns false even though a menu is assigned to it
- How to change the menu mark up with walker_nav_menu class?
- Add # to submenu URLs automatically
- Costum walker with sub menu item count
- Unable to nest categories in menu
- Trying to add Newline in Menu item
- Can I now add a class in the anchor of my menu item with WordPress 5.4?
- How can I order these pages in this navigation bar on this old wordpress theme?
- Modifying Woocommerce menu based on tags and categories
- Add href to tag in nav menu for mobile
- How to change navwalker’s dropdown mark-up?
- Bootstrap navbar responsiveness on WordPress theme menu not working
- Creating custom vertical menu
- Custom location for menu
- No indication of menu
- How to get current menu item “CSS Classes” value?
- Set menu item class into body
- List WordPress Custom Menu’s active parent level’s children as separate menu
- register_nav_menus and wp_nav_menu issue, not displaying independent menus
- Convert a custom bootsrap based menu to wordpress nav walker
- How do I get the menu items based on name or ID?
- Menu problem : when add wordpress element in menu it convert into empty custom link
- Problems with the navigation menu