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
- Getting a List of Currently Available Roles on a WordPress Site?
- Editor can create any new user except administrator
- 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?
- What action should I hook into when adding roles and capabilities?
- What is valid timing of using current_user_can() and related functions?
- Allow Contributor to change the author of his own post?
- Groups of capabilities: users with multiple roles?
- User-edit role setting distinct from wp_capabilities? [closed]
- 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
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- How to assign specific users the capability to edit specific pages / posts / custom post types
- Hide Admin Menu for Specific User ID who has administrator Role
- How can I grant capabilities directly to users (not roles) in wp-admin?
- Disable posts, only allow to edit existing pages, not create new ones (create_posts)
- Allowing an email as the username?
- Check if specific username is logged in
- How to update user role without logout
- How to manually activate user in dashboard only by admin
- How to check user role without using current_user_can()
- What exactly is WordPress?
- Post list based on the user that is logged in
- REST API: How can I restrict a custom post type to only be accessible by authenticated users?
- How do you add a custom option to user data?
- Basic auth WordPress REST API dilemma
- Do not allow users to create new posts and pages
- Menu capability in WordPress
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- Does the “promote_users” capability allow someone to create a new admin account?
- 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
- How to assign capabilities to user NOT to User Role
- How to programmatically add a user to a role?
- Prevent user creating new users with specific roles
- how to add custom user capabilities using add_user_meta or something else?
- 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”?
- Listing all capabilities in dropdown is returning boolean
- Add Media Upload Capabilities Needed for Custom Role for non-Posts
- Front end user meta options for users
- How-to Delay The Capability To Publish Posts?
- Can you have multi-site WP and keep users separate?
- How to restrict specific post types from being read or added by specific user roles (eg. author)?
- Custom user profile, registration, login page with theme
- How to display only logged in user’s post comments in comments area
- add_cap only adding the first two in array
- WordPress allow access only one custom post type “xyz” to custom user role but need to hide all admin panels
- How to customize wp_signon()
- Is there a simple way to manage capabilities per user?
- What is the difference between “create_users” and “add_users” capabilities?
- How can I prevent a writer from being able to edit an article that has been scheduled?
- Prevent Admin user to edit/see super admin from users list
- Check whether user can delete a given post
- How can I get multisite primary blog (url or path) for current user?
- Allow Users Access to Custom Post Type Only
- Capability for allowing user to post own comments without moderation
- 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
- Multiple Authors on Single Post
- 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
- how to assign more permission to wordpress author
- Allow unfiltered HTML in titles for low level users?
- Custom post type capabilities require “create_posts” to access the edit posts list page
- In MultiSite, can some users automatically have Site Admin rights on all sites, without granting them Network Admin access?
- Allow users to set a post author
- Share user table from WP with Drupal
- Unify the roles and caps?
- 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?
- Get User Role by ID not working
- Remove menu items from admin page and limit capabilities
- 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
- Managing Users and Creating Groups [closed]
- show text If special user is logged
- How to show a admin bar menu item only to users with certain capabilities?
- Upgrade Nightmare – No Posts, Permissions Issues and Can’t Create a new post
- Restricted registrations or removing the ability to edit your password/email
- How to disable a specific page for a specific user