Try using below code to remove administrator and editor option from drop down. Use
editable_roles
filter
function wdm_user_role_dropdown($all_roles) {
global $pagenow;
if( current_user_can('editor') && $pagenow == 'user-edit.php' ) {
// if current user is editor AND current page is edit user page
unset($all_roles['administrator']);
unset($all_roles['editor']);
}
return $all_roles;
}
add_filter('editable_roles','wdm_user_role_dropdown');
Related Posts:
- How do I remove dashboard access from specific user roles?
- Prevent author from changing their posts if admin has modified
- Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
- How to remove administrator role in settings -> general -> New User Default Role?
- Create un-removeable user
- Custom CSS In Admin Only For Certain Roles
- Remove ability to access certain admin menus
- How to remove “Super Admin” from All Users for those that are not a “Super Admin”?
- Customize the upload screen
- Blocking Administrative Access to Authors and Subcribers?
- Customize Admin Users Screen based on Role
- Make certain pages uneditable by editors?
- Restrict dashboard access for specific user roles to specific actions
- How can I restore admin capabilities?
- What determines whether admin toolbar is shown to a logged-in user?
- How do you set up a WordPress blog with multiple authors to allow something like StackExchange’s “community wiki” feature?
- WordPress Remove Submenus
- Only Admin can Edit, Delete or Update
- add_cap for editor but no admin role
- Shared account / dual blogging in WordPress
- Bind custom role to admin page
- remove menus for a specific role?
- current_user_can(‘administrator’) not working in custom login
- Show global Message in User Profiles with admin only Input field in WordPress Backend
- How to make sure your admin doesn’t hi-jack you site?
- Redirect admin 403 “Cheatin uh?” admin pages
- Given multiple admin accounts, how can I make it so that only admin with X username can edit posts
- How should I setup the “Users” area to hand over to a client?
- solution to prevent specific admins from altering site contents
- Admin user roles/permissions
- Posts in sidebar only by admin
- Redirect non-admin after login, and in url – /admin
- Hide top admin panel for non admin and non editors
- How can I create multiple different admin roles with their own capabilities
- Different role for free and pro users in wordpress without using bbpress
- Different customer login form than administrator login form?
- Hide other users’ posts in admin panel
- Editor Styles and Typekit
- WordPress admin stylesheet
- Can an admin check passwords of registered users?
- Showing WP_Error message with admin_notice action hook
- Taxonomy/category hierarchy lost when editing posts [closed]
- Remove post from new menu in top bar
- Possible to create placeholder images in WordPress editor that are clickable (should bring up uploader)?
- How to maintain wordpress site blogs in production and staging?
- Pagination Error on Admin (You do not have sufficient permissions)
- how to display “Edit | Quick Edit | Trash | View” in custom WP_List_Table column?
- How to publish page that can’t be detected by search engines?
- Custom taxonomy admin page
- How can I activate Collapse Menu in WordPress?
- Help extending custom drag-drop page ordering on admin page list screen
- How do I enable new account notification emails (to the administrator)?
- How to change admin menu position of “Media”?
- How to disable automatic excerpt generation *in admin*?
- Hide Updates from Admins that don’t equal a set Username
- Associating custom submenu item with post type of top level menu item
- wp_schedule_event only when admin is visited
- Two admins in Users and one in the database?
- Single category’s posts list in admin menu
- Hook to plugins admin settings
- Hide one admin from another admin
- Using shared SSL for login/admin
- Get a listing of portfolio items and categories
- page not updating with database
- Client system for media review?
- Redirect from the dashboard to edit.php if wp_is_mobile() is true
- Seems that admin_post_{action} does not executing
- WordPress 3.1’s admin bar disappears only leaving its 28 px padding (in ubuntu)!
- How to log out from admin or front-end only?
- WordPress Brute Force Prevention
- admin_enqueue_scripts not rending JS file correctly
- Can’t login to my admin area
- Allow admins to login as other users
- how to show admin notice in custom menu page after submitting the form?
- Accidentally changed website url
- Private post hidden from Admin too
- Send admin to a different login than users?
- How to change the descriptive text on the menus admin page?
- Having problem creating local instance of wordpress site
- WordPress Plugin Admin Tab
- Call require_once form admin page with checkbox
- Unable to access admin web page
- Error “Sorry, you are not allowed to access this page”
- Create WordPress Menu Item Without Linking to a Custom Page
- Search Only Works when Logged into Admin
- exclude ID on avatar
- Missing content on website. Admins cant sign in
- Is Post-Form Resubmission somehow prevented in WordPress 4.2.2?
- WordPress login not working
- Enqueue script throws error in console
- How to sort post_meta in edit.php?
- Scripts are not called until I login from wordpress backend
- Link to all posts page?
- Calculate and save an average in a meta
- If the only thing I use MySQL for is WordPress, do I need MySQL’s timezone tables?
- plugin to upload to youtube via wordpress [closed]
- My Account Lost Administrator permission
- WordPress admin panel is blank
- deploying a standard build of wordpress in WHM/cPanel
- WordPress site down for my IP only after trying to implement .htaccess whitelist