Don’t remove the capability – this will make all editors unable to edit all posts. Instead, use a filter to conditionally determine if the post can be edited:
function wpse_187738_map_meta_cap( $caps, $cap, $user_ID, $args ) {
if ( $cap === 'edit_post' && $args && ! current_user_can( 'manage_options' ) /** Only proceed for non-administrators */ ) {
$post_id = $args[0];
if ( has_tag( 'tag_slug_or_id', $post_id ) )
$caps[] = 'not_allowed';
}
return $caps;
}
add_filter( 'map_meta_cap', 'wpse_187738_map_meta_cap', 10, 4 );
Related Posts:
- Change post status based on user role
- Pending status by default for a specific role
- Allowing user to edit posts based on the post status
- allow editors to edit menus?
- How to change a user’s role?
- Is there way to rename user role name without plugin?
- How to add a Capability to a User Role?
- How can I get a list of users by their role?
- Is it possible to add new user Roles?
- Temporarily give ‘manage_options’ capability
- Hide specific admin users’ posts
- How to filter the role selector?
- How can I change a user role upon visiting a page?
- How to let the Contributor role preview unpublished posts?
- Assign Subscriber capabilities to a custom user role
- How to allow registered users to change their user role through frontend?
- how to change user roles for users who doesn’t have any. (about 8000 users)
- Shold I manually add ‘cap’ to admin role ?
- Getting a user role from the user login name
- 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
- How to add author role as a custom field to custom post type in wordpress?
- How are roles stored in the database?
- How to delete user roles?
- How to display user role
- I am adding a new class to my body tag if the logged in user is subscriber, need help
- How to Orderby User Role?
- Users Role and Access
- Prevent custom user role to add new pages
- Hide Specific User Page
- The delete_posts capability?
- Capabilites not working [closed]
- Why does this check to see if user is authorized to edit a post fail for all but super admins?
- get approved users only ( ultimate member plugin )
- Create Super Admin that cant be deleted
- Assign second role to user
- Adding Capabilities to a WordPress User Account
- Adding an additional role to an Administrator
- Allow editors to post iframes [duplicate]
- if user has a certain role then display image
- Parent User and Child User – relate users
- My subscriber has the “edit comment” capability but can’t edit comment
- 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?
- Add custom role across network in multisite
- 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?
- how to remove some permissions from a shop “manager role” in woocommmerce?
- reset the users roles – is there a way to do this?
- Get and display a user’s profile info?
- How to get a users list by who created them?
- Paypal API and WordPress
- Is there a Capability that checks as true for non-logged in users?
- Custom wordpress admin page/url “You do not have sufficient permissions to access this page.”
- user_can() not working for comment authors
- How to write conditions based on user capabilities not on user role?
- How to restrict an admin page, if the user is not superadmin?
- remove_cap nothing changes
- get_post_meta with related user
- How to change a user’s role depending on date registered?
- Capabilities don’t add
- Migrating Roles from one environment to another
- Show menu in sidebar if on specific page AND specific user role (is_page, current_user_can)
- Letting users create a post that is a custom post type from a page
- Conditional Tag for Wishlist membership. If the user is added to two levels show particular content
- How to create a front facing user sign up, log in and profile pages like FoodGawker.Com [closed]
- Learndash change user role after completing the course
- How to disable activation email to specific user role?
- logout users with specific role after close browser tab
- Admin user name not showing up in author dropdown
- Adding all custom capabilities to admin
- Is there a way to allow users with “Subscriber” user role to access media library in backend and frontend
- current_user_can( ‘edit_user’ ) does not work
- Separate user bases or hide users of another role or connected to another minisite
- How to restrict subscriber editing other posts but read specific posts in backend
- grant multiple roles access to specific admin menu item
- Publishing post strips custom html element when user is not admin
- Best practices to handle multilpe roles and capabilities?
- Check what capabilitie(s) an action requires
- Allow multiple roles to specific user
- user has permission to read a custom post but it is not being shown in wordpress plugin
- Restrict custom fields based on user roles
- Restrict content piece by role – Protection message in content?
- Select dropdown with 2 choices from foreach
- translate_user_role doesn’t work
- Force “submit for review” on update?
- Allow users to change author of post
- Is there a way for a limited user to just view the page of a post without being able to edit it?
- How do I make a draft post accessible to everyone?
- Authors Ability to Review Post from Contributors
- How to assign role to a custom registration form?
- How to add user roles? [closed]
- Check if specific role exists
- WordPress users roles wp-admin
- User roles empty