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:
Start Here
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@OFCHOICE.LOCAL --user_pass=PASSWORD
Replace EMAIL@OFCHOICE.LOCAL
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@OFCHOICE.LOCAL --role=administrator
Replace USERNAME
and EMAIL@OFCHOICE.LOCAL
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@OFCHOICE.LOCAL --role=administrator --user_pass=PASSWORD
Replace USERNAME
, EMAIL@OFCHOICE.LOCAL
, and PASSWORD
with the desired username, e-mail, and password.
Now try logging into the WordPress admin!