PHP Class Role_Command, wp-cli

## EXAMPLES # List roles. $ wp role list --fields=role --format=csv role administrator editor author contributor subscriber # Check to see if a role exists. $ wp role exists editor Success: Role with ID 'editor' exists. # Create a new role. $ wp role create approver Approver Success: Role with key 'approver' created. # Delete an existing role. $ wp role delete approver Success: Role with key 'approver' deleted. # Reset existing roles to their default capabilities. $ wp role reset administrator author contributor Success: Reset 3/3 roles.
Inheritance: extends WP_CLI_Command
Mostrar archivo Open project: wp-cli/wp-cli

Public Methods

Method Description
create ( $args, $assoc_args ) Create a new role.
delete ( $args ) Delete an existing role.
exists ( $args ) Check if a role exists.
list_ ( $args, $assoc_args ) List all roles.
reset ( $args, $assoc_args ) Reset any default role to default capabilities.

Private Methods

Method Description
persistence_check ( )

Method Details

create() public method

## OPTIONS : The internal name of the role. : The publicly visible name of the role. [--clone=] : Clone capabilities from an existing role. ## EXAMPLES # Create role for Approver. $ wp role create approver Approver Success: Role with key 'approver' created. # Create role for Product Administrator. $ wp role create productadmin "Product Administrator" Success: Role with key 'productadmin' created.
public create ( $args, $assoc_args )

delete() public method

## OPTIONS : The internal name of the role. ## EXAMPLES # Delete approver role. $ wp role delete approver Success: Role with key 'approver' deleted. # Delete productadmin role. wp role delete productadmin Success: Role with key 'productadmin' deleted.
public delete ( $args )

exists() public method

Exits with return code 0 if the role exists, 1 if it does not. ## OPTIONS : The internal name of the role. ## EXAMPLES # Check if a role exists. $ wp role exists editor Success: Role with ID 'editor' exists.
public exists ( $args )

list_() public method

## OPTIONS [--fields=] : Limit the output to specific object fields. [--format=] : Render output in a particular format. --- default: table options: - table - csv - json - count - yaml --- ## AVAILABLE FIELDS These fields will be displayed by default for each role: * name * role There are no optional fields. ## EXAMPLES # List roles. $ wp role list --fields=role --format=csv role administrator editor author contributor subscriber
public list_ ( $args, $assoc_args )

reset() public method

## OPTIONS [...] : The internal name of one or more roles to reset. [--all] : If set, all default roles will be reset. ## EXAMPLES # Reset role. $ wp role reset administrator author contributor Success: Reset 1/3 roles. # Reset all default roles. $ wp role reset --all Success: All default roles reset.
public reset ( $args, $assoc_args )