Reset a WordPress admin password
If you don’t have an admin login or you simply forgot your admin password, this doc will go over how you can gain access to the WordPress admin for a Local site on your computer using WP-CLI.
Table of Contents:
Right-click on the site in Local’s sidebar and click “Open site shell.”
Reset a current user’s password
If you’d to reset the password for a current administrator on the site, but don’t know the username run:
wp user list
This will generate a list of users currently on the site.
Once you know the username you’d like to reset the password for run:
wp user update [email protected] --user_pass=PASSWORD
[email protected] and
PASSWORD to your email and new password like the screenshot below.
Create a new user and password
If you do not currently have a user and need to create a new one run:
wp user create USERNAME [email protected] --role=administrator
[email protected] with the desired username and e-mail like the screenshot below.
A random password will be generated after the command is ran. If you wish to define a password, you can add the
--user_pass argument like so:
wp user create USERNAME [email protected] --role=administrator --user_pass=PASSWORD
[email protected], and
PASSWORD with the desired username, e-mail, and password.
Now try logging into the WordPress admin!