wp user <command>

Manages users, along with their roles, capabilities, and meta.

See references for Roles and Capabilities and WP User class.

EXAMPLES EXAMPLES

# List user IDs
$ wp user list --field=ID
1

# Create a new user.
$ wp user create bob bob@example.com --role=author
Success: Created user 3.
Password: k9**&amp;I4vNH(&amp;

# Update an existing user.
$ wp user update 123 --display_name=Mary --user_pass=marypass
Success: Updated user 123.

# Delete user 123 and reassign posts to user 567
$ wp user delete 123 --reassign=567
Success: Removed user 123 from http://example.com

Top ↑

SUBCOMMANDS SUBCOMMANDS

Name Description
wp user add-cap

Adds a capability to a user.

wp user add-role

Adds a role for a user.

wp user check-password

Checks if a user’s password is valid or not.

wp user create

Creates a new user.

wp user delete

Deletes one or more users from the current site.

wp user generate

Generates some users.

wp user get

Gets details about a user.

wp user import-csv

Imports users from a CSV file.

wp user list

Lists users.

wp user list-caps

Lists all capabilities for a user.

wp user meta

Adds, updates, deletes, and lists user custom fields.

wp user remove-cap

Removes a user’s capability.

wp user remove-role

Removes a user’s role.

wp user reset-password

Resets the password for one or more users.

wp user session

Destroys and lists a user’s sessions.

wp user set-role

Sets the user role.

wp user spam

Marks one or more users as spam.

wp user term

Adds, updates, removes, and lists user terms.

wp user unspam

Removes one or more users from spam.

wp user update

Updates an existing user.

Command documentation is regenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.