WP-CLI: Reset an Admin Password or Create an Admin User When Locked Out
From the command line you can recover access without email.
Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Reset a password
- Connect by SSH to the server and go to the site folder.
- List users:
wp user list. - Set a new password for a user ID:
wp user update 1 --user_pass='new-strong-password'.
Create a temporary admin
wp user create name email@example.com --role=administrator
Remove it when done.
Afterwards
- Use a long, unique password from a password manager. See password managers.
- Review all admin users. See WordPress Admin Users You Did Not Create: What to Do.
Without SSH, see Locked Out of WordPress Admin: Reset Your Password Without Email.
Related guides
- Writing Clear Error Reports: Screenshots, URLs and Steps
- WordPress Tag and Date Archives Duplicate Content: Settings
- WordPress Permalinks Change: Redirect Old URLs and Avoid 404s
- Error Establishing a Database Connection in WordPress: Full Checklist
Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.