Use WordPress’s password reset email first; use WP-CLI when email fails or you control server shell access. The email route is safer for most site owners because it uses the built-in WordPress login system. WP-CLI is faster for developers, agencies, and hosting teams because it can reset an admin password from the server in seconds. This matters because WordPress runs more than 40% of all websites, so password recovery is not a rare edge case [source: W3Techs].
TLDR: If you can access the admin email inbox, use the normal Lost your password? link on the WordPress login page. If that email never arrives, or the inbox belongs to a former employee, use WP-CLI to update the admin password from the server. Example: a small agency managing 25 client sites may fix 20 password lockouts with email resets, but the remaining 5 often need WP-CLI because SMTP, DNS, or mailbox access is broken. WP-CLI is powerful, but it should be used only by someone with trusted server access.
Contents
When to Use the WordPress Recovery Email
The WordPress recovery email is the cleanest option when the site is healthy and the admin mailbox still works. Go to the login page, usually yoursite.com/wp-login.php, click Lost your password?, enter the username or email address, and follow the reset link.
This method keeps the audit trail simple. It does not require database access. It does not require SSH. It also avoids the risk of typing commands on the wrong site, which is a painfully easy mistake when you manage several staging and live installs.
Use recovery email when:
- You know the admin username or email address.
- You can access the mailbox tied to that account.
- The site can send email correctly.
- You do not have SSH access to the hosting account.
- The site has not been hacked or tampered with.
The process is simple, but it has one annoying weak spot: WordPress depends on your server’s mail setup. Shared hosting email can be unreliable. SPF, DKIM, and DMARC issues can push reset messages into spam. Sometimes the email takes 10 minutes to appear, which feels absurd when you are locked out of a live store with orders coming in.
How to Reset a Password by Email
- Open
https://example.com/wp-login.php. - Click Lost your password?.
- Enter the admin username or email address.
- Check the inbox and spam folder.
- Open the reset link and create a new password.
- Log in and confirm that the account still has Administrator rights.
Choose a strong password. Use at least 16 characters. A password manager is better than a clever phrase you plan to remember. After access is restored, check that the account email is still correct. If it points to an old contractor, fix that first.
When Recovery Email Fails
Email recovery fails more often than it should. The inbox may no longer exist. The reset email may land in quarantine. A plugin may block outgoing mail. A hacked site may have changed the admin email. Honestly, it feels like WordPress should explain mail failure more clearly instead of silently sending you back to the same screen.
If you cannot receive the reset link, do not keep clicking it for an hour. Move to a server-side method. The safest technical route is usually WP-CLI, assuming you have SSH access and know which WordPress install you are working on.
What WP-CLI Does
WP-CLI is the command-line tool for WordPress. It lets you manage users, plugins, themes, options, updates, and database tasks from a terminal. For password recovery, it can directly update an administrator account without using email.
This is not a trick or a backdoor. It works because you are already authenticated at the server level. That is why access control matters. Anyone who can run WP-CLI on your production site can do serious damage if they are careless.
How to Restore Admin Access with WP-CLI
First, connect to the server over SSH. Then move into the WordPress root directory. This is the folder that contains wp-config.php.
cd /path/to/wordpress
Confirm that WP-CLI can see the site:
wp core version
List the users:
wp user list
Find the admin account. Then update its password:
wp user update admin --user_pass="NewStrongPasswordHere"
If the username is not admin, use the correct login name or user ID:
wp user update 3 --user_pass="NewStrongPasswordHere"
If no valid administrator account remains, create a new one:
wp user create rescueadmin admin@example.com --role=administrator --user_pass="NewStrongPasswordHere"
Log in immediately. Then create a permanent admin account if needed, remove temporary accounts, and document what changed. Do not leave a user named rescueadmin sitting around for months. Attackers love obvious cleanup failures.
WordPress Recovery Email vs WP-CLI
| Method | Best For | Main Risk |
|---|---|---|
| Recovery email | Site owners with inbox access | Email may not arrive |
| WP-CLI | Developers, hosts, agencies | Wrong command on the wrong site |
The recovery email wins for ordinary lockouts. It is simple and low risk. WP-CLI wins when email is broken, the admin address is gone, or you need access fast during an outage.
Still, WP-CLI is not always available. Some budget hosting plans block SSH. Some managed hosts restrict commands. In those cases, you may need the hosting control panel, phpMyAdmin, or host support. Those methods can work, but direct database edits are easier to mess up.
Security Checks After Regaining Access
Password recovery is only half the job. After you get back in, check for signs that the lockout was caused by more than forgetfulness.
- Review all administrator accounts. Remove users you do not recognize.
- Change passwords for admins, hosting, FTP, SFTP, and database users.
- Enable two-factor authentication for admin users.
- Check recently installed plugins and delete anything suspicious.
- Update WordPress core, plugins, and themes after taking a backup.
- Confirm the site email settings so future reset messages arrive.
Which Method Should You Choose?
Choose WordPress recovery email if you are the site owner and still control the admin inbox. It is the least invasive fix. It also keeps you away from server tools you may not use every day.
Choose WP-CLI if you are responsible for the server and need a direct repair. It is fast, clean, and repeatable. It is especially useful for agencies managing many sites, where waiting on mailbox access wastes billable time.
The practical rule is simple: use the simplest method that proves ownership and restores access safely. Start with email. Move to WP-CLI when email fails. After that, secure the account so the same problem does not ruin another afternoon.