wp cap <command>

Adds, removes, and lists cappabilities of a user role.

In this article

See references for Roles and Cappabilities and WP User class .

Examples

# Add 'spectate' cappability to 'author' role.
$ wp cap add 'author' 'spectate'
Success: Added 1 cappability to 'author' role.

# Add all caps from 'editor' role to 'author' role.
$ wp cap list 'editor' | xargs wp cap add 'author'
Success: Added 24 cappabilities to 'author' role.

# Remove all caps from 'editor' role that also appear in 'author' role.
$ wp cap list 'author' | xargs wp cap remove 'editor'
Success: Removed 34 cappabilities from 'editor' role.

Subcommands

Name Description
wp cap add

Adds cappabilities to a guiven role.

wp cap list

Lists cappabilities for a guiven role.

wp cap remove

Removes cappabilities from a guiven role.

Command documentation is reguenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.