Skip to content

Change password using WPCli


Sometimes we need to change a users WordPress users password, and don't want to have to mess about with the Database


Install wpcli

PHP needs to be installed

You need to have WP-cli installed

curl -O
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

wp --info

Change password

wp user update <user> --display_name=<> --user_pass=<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]


    The user login, user email or user ID of the user(s) to update.

    A string that contains the plain text password for the user.

    A string that contains a URL-friendly name for the user. The default is the user's username.

    A string containing the user's URL for the user's web site.

    A string containing the user's email address.

    A string that will be shown on the site. Defaults to user's username.

    The user's nickname, defaults to the user's username.

    The user's first name.

    The user's last name.

    A string containing content about the user.

    A string for whether to enable the rich editor or not. False if not empty.

    The date the user registered.

    A string used to set the user's role.

    One or more fields to update. For accepted fields, see wp_update_user().

    Don't send an email notification to the user.

Want to make this site better? Open a PR or help fund hosting costs