Skip to content

Commit 80e2367

Browse files
Add explanation of what happens for wp role reset (#58)
1 parent 56575d1 commit 80e2367

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ Resets any default role to default capabilities.
187187
wp role reset [<role-key>...] [--all]
188188
~~~
189189

190+
Uses WordPress' `populate_roles()` function to put one or more
191+
roles back into the state they were at in the a fresh
192+
WordPress install. Removes any capabilities that were added,
193+
and restores any capabilities that were removed. Custom roles
194+
are not affected.
195+
190196
**OPTIONS**
191197

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

198204
**EXAMPLES**
199205

200-
# Reset role.
206+
# Reset three roles.
201207
$ wp role reset administrator author contributor
202-
Success: Reset 1/3 roles.
208+
Restored 1 capability to and removed 0 capabilities from 'administrator' role.
209+
No changes necessary for 'author' role.
210+
No changes necessary for 'contributor' role.
211+
Success: 1 of 3 roles reset.
212+
213+
# Reset a custom role.
214+
$ wp role reset custom_role
215+
Custom role 'custom_role' not affected.
216+
Error: Must specify a default role to reset.
203217

204218
# Reset all default roles.
205219
$ wp role reset --all

src/Role_Command.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ public function delete( $args ) {
245245
/**
246246
* Resets any default role to default capabilities.
247247
*
248+
* Uses WordPress' `populate_roles()` function to put one or more
249+
* roles back into the state they were at in the a fresh
250+
* WordPress install. Removes any capabilities that were added,
251+
* and restores any capabilities that were removed. Custom roles
252+
* are not affected.
253+
*
248254
* ## OPTIONS
249255
*
250256
* [<role-key>...]
@@ -255,9 +261,17 @@ public function delete( $args ) {
255261
*
256262
* ## EXAMPLES
257263
*
258-
* # Reset role.
264+
* # Reset three roles.
259265
* $ wp role reset administrator author contributor
260-
* Success: Reset 1/3 roles.
266+
* Restored 1 capability to and removed 0 capabilities from 'administrator' role.
267+
* No changes necessary for 'author' role.
268+
* No changes necessary for 'contributor' role.
269+
* Success: 1 of 3 roles reset.
270+
*
271+
* # Reset a custom role.
272+
* $ wp role reset custom_role
273+
* Custom role 'custom_role' not affected.
274+
* Error: Must specify a default role to reset.
261275
*
262276
* # Reset all default roles.
263277
* $ wp role reset --all

0 commit comments

Comments
 (0)