WordPress WP-CLI 2 cheatsheet

WordPress WP-CLI 2: Users

4 common WordPress WP-CLI 2 tasks.

List users

Show users with their roles.

wp user list

Create a user

Create an editor account. WP-CLI prints a generated password unless you pass --user_pass.

wp user create jane [email protected] --role=editor

Reset a user's password

Set a new password for the user with ID 1. Use a real password.

wp user update 1 --user_pass=change-me

Delete a user and keep their posts

Delete a user and reassign their content to user 1.

wp user delete 5 --reassign=1

Caution: Without --reassign, the user's posts are deleted too.

Was this page helpful?