I think you are using it right. I think it is actually a bug in WordPress.
When you do the same for roles $somerole->add_cap( 'some_cap', false );
, it works as expected.
Related Posts:
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- How to get all capabilities of an existing user role
- The ‘user_has_cap’ hook seems to take two page loads to trigger
- Subsite access without being a member of the subsite in wp multisite network
- Where are $current_user->allcaps set?
- Can I Create a Second Admin Level User Role?
- Redirect admin 403 “Cheatin uh?” admin pages
- How do I create a custom role capability?
- How to programatically change username (user_login)?
- Remove Ability for Other Users to View Administrator in User List?
- Groups of capabilities: users with multiple roles?
- What’s the difference between the capability remove_users and delete_users?
- How to restrict access to uploaded files?
- What’s the difference between Role and Meta capabilities; When to use map_meta_cap() filter
- Allowing users to edit only their page and nobody else’s
- Can an admin check passwords of registered users?
- How to let contributors to create a new revision(draft) editing their published posts
- How to assign specific users the capability to edit specific pages / posts / custom post types
- Basic auth WordPress REST API dilemma
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- How to enable the theme editor cap for an editor role?
- current_user_can( ‘edit_post’, $post_id ) does not work for contributer but for administrator
- Prevent user creating new users with specific roles
- Copy a user from one WordPress site to another
- How to remove “Super Admin” from All Users for those that are not a “Super Admin”?
- How-to Delay The Capability To Publish Posts?
- Custom user profile, registration, login page with theme
- WordPress allow access only one custom post type “xyz” to custom user role but need to hide all admin panels
- Is there a simple way to manage capabilities per user?
- What is the difference between “create_users” and “add_users” capabilities?
- Prevent Admin user to edit/see super admin from users list
- How can I get multisite primary blog (url or path) for current user?
- Can I create users that have access to *some* other users posts instead of all other users posts?
- Set default page for user account in admin
- User role permissions based on taxonomies
- Let new user role to ‘edit_others_posts’ of other user role, not of its own type
- How can I have different groups of editors only allowed to edit certain parent+subpages?
- Add a wordpress blog to my website having users
- Custom post type capabilities require “create_posts” to access the edit posts list page
- Share user table from WP with Drupal
- Check if someone is editing a post (this content is currently locked)
- current_user_can capabilities in the admin not working as expected
- Log all users out of all locations after 24 hours
- Hide everything on site for visitors except specific page IDs
- current user can edit user?
- Redirecting or displaying a message on first login
- Filter list of rules based on a capability
- Using author_can() on custom post types in WordPress
- Getting users by specific capability, not role
- show text If special user is logged
- How to show a admin bar menu item only to users with certain capabilities?
- How to disable a specific page for a specific user
- Roles for Custom Post Types
- Allow user access to Dashboard only!
- Does an AJAX call on the Admin Side Automatically include the User Data/Capabilities?
- Theme option editing capability problems
- add_cap not working
- Add a role and give admin priviledges
- How to restrict author to only access one custom post type ?
- Create custom post with custom user rules
- Usage of current_user_can()
- Users can only view their content from the front end
- Remove capability from specific user
- How can I prevent certain custom roles from seeing other custom roles on the user list page?
- Administrator role capabilities
- How to get all capabilities
- What’s the correct way to add capabilites to user roles?
- Allow admins to login as other users
- Prevent all users from editing posts except admins using hooks
- Delete a user from frontend
- How to handle this specific case of custom post type?
- Why cannot author edit pages?
- Add capability to a role , so user is only able to view his own posts
- Plugin page and capabilities
- Remove specific administrator’s capability
- how to change capability required to view an admin page? [duplicate]
- define two login page url
- Allow a user or role to view drafts and previews, but not other admin privileges?
- current_user_can() causing critical error
- How to make WordPress ‘editor’ role to list/view/add/edit users only with the role ‘author’?
- Author Error “Sorry, you are not allowed to access this page.”
- Create a Capability category to group a few custom Capabilities
- restrict admin panel sections to users
- Check what capabilitie(s) an action requires
- Disabling user capability to edit_posts or delete_posts in the front-end
- WordPress install checking permissions of user id 0
- admin can not change author profile picture
- throttle/limit a logged in user’s http requests to specific page on a per day basis
- Allowing users to edit only their page and nobody else’s
- How to bulk change user role to “No role for this site”
- Can’t create new Pods pages
- Is there a way of retrieving the core WP capabilities?
- Pricing Tables admin page capability
- Control Category of each user can post
- Not able to give editors acess to new admin menu item
- Want to add post to user dashboard
- Is it possible to tell if a user is logged into WordPress from looking at the cookies which are set?
- How to have a WordPress user profile just having one button and one input textbox?
- determine active user browser at the same time
- MySQL query to list users who never signed in