Are you looking to reset a user’s password in your WordPress site but don’t want to go through the hassle of logging into the web-based interface? Look no further than the WP-CLI command line tool!

What is WP_CLI

WP-CLI is a command-line interface for WordPress, and it is a set of command-line tools for managing WordPress installations on a server. It allows the WordPress admin users to carry out different administrative tasks without actually using a web browser.

Reset password using Command Line

The following steps will show you how to reset your WordPress password using the command line

Step 1: List the WordPress users

You need to go to the directory where your web root is located or where your wp-config.php file is located. Otherwise, WP-CLI will not work. Type the below command to view all the users

wp user list

Step 2: Change the Password

Once the list has been generated, find the name and user ID of the admin user whose password you want to reset. Run the following command to change the user’s password.

wp user update ID –user_pass=new_password

In this example, “user” should be replaced with the username of the user whose password you want to reset. “new_password” should be replaced with the new password you want to set for the user. Replace the ID with your user’s ID . As soon as you type this command and hit Enter, the user’s password will be changed to the new value you’ve specified.


After setting up a new admin password via WP-CLI, it’s a good idea to test the changes to be sure the password was applied correctly. Resetting a user’s password with WP-CLI is a quick and easy process that can be especially useful for managing large numbers of WordPress sites or for automating tasks. Next time you need to reset a user’s password, give this tutorial a try!