Change password using WPCli
Why
Sometimes we need to change a users WordPress users password, and don't want to have to mess about with the Database
How
Install wpcli
PHP needs to be installed
You need to have WP-cli installed
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
Move to the directory of a WordPress site and run the below
Change password
<user>
: The user login, user email or user ID of the user(s) to update.
CLI Reference
wp user update
Updates an existing user.
wp user update <user>... [--user_pass=<password>] [--user_nicename=<nice_name>] [--user_url=<url>] [--user_email=<email>] [--display_name=<display_name>] [--nickname=<nickname>] [--first_name=<first_name>] [--last_name=<last_name>] [--description=<description>] [--rich_editing=<rich_editing>] [--user_registered=<yyyy-mm-dd-hh-ii-ss>] [--role=<role>] --<field>=<value> [--skip-email]
OPTIONS
[--user_pass=
[--user_nicename=
[--user_url=
[--user_email=
[--display_name=
[--nickname=
[--first_name=
[--last_name=
[--description=
[--rich_editing=
[--user_registered=
[--role=
--
[--skip-email] Don't send an email notification to the user.
Want to make this site better? Open a PR or help fund hosting costs