Please add the following code.
function activate_plugin_name() {
$role = get_role( 'editor' );
$role->add_cap( 'manage_options' ); // capability
}
// Register our activation hook
register_activation_hook( __FILE__, 'activate_plugin_name' );
function deactivate_plugin_name() {
$role = get_role( 'editor' );
$role->remove_cap( 'manage_options' ); // capability
}
// Register our de-activation hook
register_deactivation_hook( __FILE__, 'deactivate_plugin_name' );`
Refer my tutorial for further explanation.
http://www.pearlbells.co.uk/user-role-editor-access-wordpress-plugins/
Related Posts:
- Allow users to publish child pages of the pages they have access to edit
- Programmatically allow a non-author to edit a post based custom meta field
- wordpress editor role remove all but ‘menus’ in appearance menu
- Give Editor Access to Custom Theme Options
- Could we know who published a post on WordPress?
- Blank Screen Edit Page when using Editor Role
- used code below to allow Editor access to menus – but change permanent, how do I revert?
- How to get role of user
- How do I programmatically set default role for new users?
- What do unfiltered_html and unfiltered_upload actually filter?
- Temporary capability for current_user_can()
- How to update role capabilities
- Code needed to only show users own posts in a multi-user account
- Disable text tab on WordPress text-editor
- Restrict Author to pick from media library, but not upload media
- Remove Ability for Administrators to Delete Administrators
- Order users by custom user meta
- how to change user roles for users who doesn’t have any. (about 8000 users)
- List total number of users that are authors
- Shold I manually add ‘cap’ to admin role ?
- Getting a user role from the user login name
- Auto Delete Users (auto_delete_users)
- New Roles and Capabilities in WordPress
- Why is wp-login redirecting to the home page when I use this function?
- Allow contributor to view own scheduled post
- Editor and contributor roles not correct after adding function
- WordPress Super Admin
- How are roles stored in the database?
- How to delete user roles?
- How to ‘unpublish’ or ‘hide’ posts when user role changes?
- Can’t manage to make translate_user_role() work
- How to Orderby User Role?
- Prevent custom user role to add new pages
- Hide Specific User Page
- The delete_posts capability?
- get approved users only ( ultimate member plugin )
- Restrict other Admins from using Editor in Admin Panel
- Create Super Admin that cant be deleted
- Customizer – Allow user editor to change website title and tagline
- Query users which have same dynamically generated roles as the current user
- change role of wordpress users when they edit profile
- Adding Capabilities to a WordPress User Account
- Change post status based on user role
- Display User Role Next To Comment
- Allow an editor to change the author
- New user is assigned 2 roles: customer and superadmin
- bbPress plugin moderator roles
- how to set any post creation for pending status and let the admin approve it first?
- How to give remove role editing permission from user
- Allowing user to edit posts based on the post status
- How to have kind of a technical writer role in wp website
- Assigning certain authors to specific editors
- Make nav-menus.php available for editor
- How to make the Newsletter plugin visible to users with author privileges?
- WP welcome email depending on user role
- Allow user role “salesman” to view only “client” role users
- Purpose of Adding Capability to Role But Not Grant?
- bbPress: How to set conditional for specific user -or- user role, to be displayed in user profile
- Menu page with list of users
- How to check user role?
- Paypal API and WordPress
- How to set default post editor based on role?
- Updater user with multiple roles
- Custom user types getting html sanitized in posts
- Is there a Capability that checks as true for non-logged in users?
- Hiding custom theme functionality using capabilities
- Use PHP code to create custom user roles. Call it once?
- custom plugin not visible to some user roles
- How to write conditions based on user capabilities not on user role?
- What Capability is required to let a role RUN code in Edit Theme?
- remove_cap nothing changes
- How to change a user’s role depending on date registered?
- Need to block user role from accessing bbPress all together
- Show special backend content for certain roles
- Plugin: Front-end Editor – User role specific editable content?
- Retrieve user roles but exclude default roles
- Disabled delete_others_posts if post is from admin
- How to hide Add new Term area for taxonomy terms for specific role (Client)
- Saving user meta “member_id” based on user role
- Change logo url based on WP user role
- show the author’s role along with the name in the single.php
- Role and Capabilities: How do I allow user role to access theme options without enabling ‘manage_options’?
- How to Enable registration email for a custom user role?
- How can I add the ability for a user to add/edit administrators?
- Editor role isn’t seeing specific post type posts with only post_type parameter
- Allow signed in users (subscribers) to see their drafts
- Editor Widget Role
- How to sync user database with “user role editor” plugin enabled
- add user role selection to registration form [duplicate]
- Need to create admin user without capability to create user
- Assign specific editor with custom user meta “A” to all authors with custom user meta “A” and exclude all other author access
- Grant access to admin menu?
- Give editor ability to edit custom settings without access to Main Settings
- I want this code to work only for Authors AND Contributors
- Disable Woocommerce checkout based on user role [closed]
- Remove_role not working, gives “Call to undefined method stdClass::remove_role()”
- How to know which editor published a post programmatically?
- Adding a new role with administrator’s capabilities
- User role can’t be set
- Order Status based on User Role