Table of Contents
Table of Contents
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!
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.
If you want to install WP-CLI on your Linux machine, check out the WP-CLI installation guide.
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
The output like this
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
Replace ID with the actual user ID or username, and new_password with the desired password. This command will update the user’s password in WordPress.
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