PHP Class Capabilities_Command, wp-cli
## 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.
ファイルを表示
Open project: wp-cli/wp-cli
Public Methods
Method |
Description |
|
add ( $args ) |
Add capabilities to a given role. |
|
list_ ( $args, $assoc_args ) |
List capabilities for a given role. |
|
remove ( $args ) |
Remove capabilities from a given role. |
|
Private Methods
Method Details
## OPTIONS
: Key for the role.
...
: One or more capabilities to add.
## EXAMPLES
# Add 'spectate' capability to 'author' role.
$ wp cap add author spectate
Success: Added 1 capability to 'author' role.
## OPTIONS
: Key for the role.
[--format=]
: Render output in a particular format.
---
default: list
options:
- list
- table
- csv
- json
- count
- yaml
---
## EXAMPLES
# Display alphabetical list of Contributor capabilities.
$ wp cap list 'contributor' | sort
delete_posts
edit_posts
level_0
level_1
read
public list_ ( $args, $assoc_args ) |
## OPTIONS
: Key for the role.
...
: One or more capabilities to remove.
## EXAMPLES
# Remove 'spectate' capability from 'author' role.
$ wp cap remove author spectate
Success: Removed 1 capability from 'author' role.