Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ Resets any default role to default capabilities.
wp role reset [<role-key>...] [--all]
~~~

Uses WordPress' `populate_roles()` function to put one or more
roles back into the state they were at in the a fresh
WordPress install. Removes any capabilities that were added,
and restores any capabilities that were removed. Custom roles
are not affected.

**OPTIONS**

[<role-key>...]
Expand All @@ -197,9 +203,17 @@ wp role reset [<role-key>...] [--all]

**EXAMPLES**

# Reset role.
# Reset three roles.
$ wp role reset administrator author contributor
Success: Reset 1/3 roles.
Restored 1 capability to and removed 0 capabilities from 'administrator' role.
No changes necessary for 'author' role.
No changes necessary for 'contributor' role.
Success: 1 of 3 roles reset.

# Reset a custom role.
$ wp role reset custom_role
Custom role 'custom_role' not affected.
Error: Must specify a default role to reset.

# Reset all default roles.
$ wp role reset --all
Expand Down
18 changes: 16 additions & 2 deletions src/Role_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ public function delete( $args ) {
/**
* Resets any default role to default capabilities.
*
* Uses WordPress' `populate_roles()` function to put one or more
* roles back into the state they were at in the a fresh
* WordPress install. Removes any capabilities that were added,
* and restores any capabilities that were removed. Custom roles
* are not affected.
*
* ## OPTIONS
*
* [<role-key>...]
Expand All @@ -255,9 +261,17 @@ public function delete( $args ) {
*
* ## EXAMPLES
*
* # Reset role.
* # Reset three roles.
* $ wp role reset administrator author contributor
* Success: Reset 1/3 roles.
* Restored 1 capability to and removed 0 capabilities from 'administrator' role.
* No changes necessary for 'author' role.
* No changes necessary for 'contributor' role.
* Success: 1 of 3 roles reset.
*
* # Reset a custom role.
* $ wp role reset custom_role
* Custom role 'custom_role' not affected.
* Error: Must specify a default role to reset.
*
* # Reset all default roles.
* $ wp role reset --all
Expand Down