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

Add a capability to a user.

wp user add-role

Add a role for a user.

wp user create

Create a new user.

wp user delete

Delete one or more users from the current site.

wp user generate

Generate some users.

wp user get

Get details about a user.

wp user import-csv

Import users from a CSV file.

wp user list

List users.

wp user list-caps

List all capabilities for a user.

wp user meta

Manage user custom fields.

wp user remove-cap

Remove a user’s capability.

wp user remove-role

Remove a user’s role.

wp user session

Manage a user’s sessions.

wp user set-role

Set the user role.

wp user spam

Mark one or more users as spam.

wp user term

Manage user terms.

wp user unspam

Remove one or more users from spam.

wp user update

Update 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.