mirror of
https://gh.wpcy.net/https://github.com/wp-cli/handbook.git
synced 2026-05-03 13:52:56 +08:00
21 lines
746 B
Markdown
21 lines
746 B
Markdown
# wp cap
|
|
|
|
Adds, removes, and lists capabilities of a user role.
|
|
|
|
See references for [Roles and Capabilities](https://codex.wordpress.org/Roles_and_Capabilities) and [WP User class](https://codex.wordpress.org/Class_Reference/WP_User).
|
|
|
|
### EXAMPLES
|
|
|
|
# Add 'spectate' capability to 'author' role.
|
|
$ wp cap add 'author' 'spectate'
|
|
Success: Added 1 capability to 'author' role.
|
|
|
|
# Add all caps from 'editor' role to 'author' role.
|
|
$ wp cap list 'editor' | xargs wp cap add 'author'
|
|
Success: Added 24 capabilities 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 capabilities from 'editor' role.
|
|
|
|
|