the page you linked shows how to remove a capability from a role:
global $wp_roles;
// remove capability $cap from role $role
$wp_roles->remove_cap( $role, $cap );
and an example would be:
// for example
$wp_roles->remove_cap( 'subscriber', 'view_galleries' );
or remove a capability from a specific user:
// get the user by username say for example its admin
$user= new WP_User( null, 'admin' );
// remove a capability from the user
$user->remove_cap( 'view_galleries');
as for what hook you should use, you don’t need any just paste this code once in your theme’s functions.php file, save and remove, since the roles and capabilities are saved in the database.
Related Posts:
- 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?
- What’s the difference between Role and Meta capabilities; When to use map_meta_cap() filter
- 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)
- How to get all capabilities of an existing user role
- What exactly is WordPress?
- Menu capability in WordPress
- Does the “promote_users” capability allow someone to create a new admin account?
- current_user_can( ‘edit_post’, $post_id ) does not work for contributer but for administrator
- Add user capability and check against it
- Listing all capabilities in dropdown is returning boolean
- Add Media Upload Capabilities Needed for Custom Role for non-Posts
- add_cap only adding the first two in array
- How can I prevent a writer from being able to edit an article that has been scheduled?
- Check whether user can delete a given post
- Multiple Authors on Single Post
- Allow unfiltered HTML in titles for low level users?
- Allow users to set a post author
- Unify the roles and caps?
- current_user_can capabilities in the admin not working as expected
- Remove menu items from admin page and limit capabilities
- Filter list of rules based on a capability
- Using author_can() on custom post types in WordPress
- How to show a admin bar menu item only to users with certain capabilities?
- Restricted user capabilities cannot add image
- User capability per post
- How come I see a manage_categories capability but not a manage_tags capability for any users?
- Theme option editing capability problems
- Allow Contributor to edit published post and filter by page id
- Usage of current_user_can()
- Is it wise not to use only meta capabilities for certain basic post types?
- What capabilities are assigned to unauthenticated users?
- Capabilities Not Changing
- Assign multiple roles , overlapping capabilities
- Administrator role capabilities
- How to get all capabilities
- Prevent all users from editing posts except admins using hooks
- WordPress remove capability post ,media completely for custom role
- Add capability to “Editor” role to be able to view all users attachments
- Why cannot author edit pages?
- Add capability to a role , so user is only able to view his own posts
- Plugin page and capabilities
- how to change capability required to view an admin page? [duplicate]
- How can restrict certain users from delete a category but can view only in wordpress?
- Delete admin edit/delete links in users list wordpress admin
- Create a Capability category to group a few custom Capabilities
- Capability to edit post slugs
- admin can not change author profile picture
- Changing capability type without altering plugin
- Can’t create new Pods pages
- Is there a way of retrieving the core WP capabilities?
- Pricing Tables admin page capability
- Best Roles and Capability on a site with review features using a front end custom post
- Not able to give editors acess to new admin menu item
- Manage Roles and Capabilities on Multi-site
- How to create a WP Capability that limits editing to posts in a certain category?
- Capability needed for user to have an author page?
- Force logout when role is changed
- Getting a List of Currently Available Roles on a WordPress Site?
- Editor can create any new user except administrator
- Capabilities and Custom Post Types
- Is there way to rename user role name without plugin?
- How to create a clone role in wordpress
- How do I create a custom role capability?
- Possible to hide Custom Post Type UI/Menu from specific User Roles?
- How to add a Capability to a User Role?
- Select subscriber as author of post in admin panel?
- How can I get a list of users by their role?
- Remove Ability for Other Users to View Administrator in User List?
- How do I make a draft post accessible to everyone?
- Reset default roles and capabilities
- add_role() run only once?
- Custom post type role permissions won’t let me read
- what’s the meaning of the field wp_capabilities in table wp_usermeta
- Allowing custom role access to custom post type in back end
- WordPress SEO by Yoast: Hide Meta Boxes in Posts for Non-admins
- Why is javascript allowed in my post content?
- Groups of capabilities: users with multiple roles?
- How can I create a taxonomy meta-box with search suggestions but no new terms input?
- User-edit role setting distinct from wp_capabilities? [closed]
- What’s the difference between the capability remove_users and delete_users?
- What do unfiltered_html and unfiltered_upload actually filter?
- Allow Editors to edit pending posts but not draft ones
- Temporary capability for current_user_can()
- Custom taxonomies capabilities
- Allow user to “edit_others_posts” to save only, not publish
- How to assign multiple roles for capabilities array withini register_taxonomy function?
- Allow roles below admin to add subscribers only
- How to let contributors to create a new revision(draft) editing their published posts
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- Capabilities Vs User Meta
- 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
- add_menu_page permissions – what am I doing wrong?
- How can I modify the Capability needed to access a plugin’s options?
- Change capability type of post type registered by plugin
- How to enable a site administrator to edit users in a WordPress network/ multisite setup?
- How to 301 private posts rather than 404?