Intro
WP-CLI is a command-line tool for managing WordPress installations.
Commands:
Creating a New User
To create a new user, use the wp user create command. Here’s the syntax:
wp user create <username> <email> --role=<role> --user_pass=<password>
<username>: The desired username for the new user.<email>: The email address of the new user.<role>: The role to assign to the new user (e.g.,administrator,editor,author,contributor,subscriber).<password>: The password for the new user.
Example:
wp user create johndoe john@example.com --role=editor --user_pass=securepassword
Updating Existing User Credentials
To update an existing user’s credentials, you can use the wp user update command. Here are some common scenarios:
Update User Password
wp user update <user_id> --user_pass=<new_password>
Example:
wp user update 2 --user_pass=newsecurepassword