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.

Start Here

Right-click on the site in Local’s sidebar and click “Open site shell.”

Open site shell to use WP-CLI on your site.

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

Replace [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

Replace USERNAME and [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

Replace USERNAME[email protected], and PASSWORD with the desired username, e-mail, and password.

Now try logging into the WordPress admin!