In case you imported a site that you do not have an admin login for or you simply forgot your admin password, here’s how you can gain access to the WordPress admin for a Local site on your computer.
This requires that you know either the username or e-mail used for an admin account on the site.
- Visit the site’s WordPress Admin login page by clicking on “Admin” beside “View Site” in Local
- Click “Lost your password?”
- Enter either the username or e-mail of an account that you know is an admin.
- Note: If you created this site in Local from scratch, the default admin e-mail is firstname.lastname@example.org.
- Go to the site’s “Utilities” tab in Local
- Click “MailHog” or “Mailcatcher” depending on the site’s Environment
- Find the password reset e-mail and click the link at the bottom
- Follow the prompt to reset the password and login!
This method is best for creating new admin accounts in case you don’t know an existing admin username/e-mail.
- Right-click on the site in Local’s sidebar and go to “Open Site SSH”
wp user create USERNAME EMAIL@OFCHOICE.LOCAL --role=administrator
- Replace the
EMAIL@OFCHOICE.LOCALwith the desired username and e-mail.
- A random password will be generated after the command is ran. If you wish to define a password, you can add the
--user_passargument like so:
wp user create USERNAME EMAIL@OFCHOICE.LOCAL --role=administrator --user_pass=PASSWORD
- Replace the
- All done! Try logging into the WordPress admin with the newly created account.
If you’re curious about WP-CLI and want to learn more, see WP-CLI Commands | WordPress Developer Resources