Being locked out of your own WordPress dashboard is frustrating, especially when you need to make a quick change. The fix depends on why you are locked out: a forgotten password, a security plugin that has blocked you, a login page that keeps reloading, or, less often, a hacker who has removed your account. Here are seven ways to get back in, starting with the simplest.
Several of these involve your hosting control panel (for the file manager or phpMyAdmin) or SFTP. If you don’t have those logins, your hosting company or web developer will.
1. Reset your password by email
On the login page (yourdomain.co.uk/wp-login.php) click Lost your password? and enter your username or email address. Check your spam folder. If the email never arrives, your site may not be sending email properly, which is common on cheaper hosting. Move on to the next method.
2. Reset your password in phpMyAdmin
If email doesn’t work, you can set a new password directly in the database:
- Open phpMyAdmin from your hosting control panel and select your WordPress database.
- Open the users table. It is usually called
wp_users, but thewp_prefix may be different on your site. - Find your account and click Edit.
- In the
user_passrow, choose MD5 from the Function dropdown and type your new password in the value box. - Save, then log in with the new password. WordPress automatically upgrades it to a stronger hash on your next login.
3. Use WP-CLI
If your host gives you command-line access with WP-CLI, this is the quickest method. List the users, then set a new password:
wp user list
wp user update yourusername --user_pass="a-new-strong-password"
4. Blocked by a security plugin
Plugins like Wordfence, Limit Login Attempts or iThemes/Solid Security can lock you out after too many failed attempts, block your IP address, or ask for a two-factor code you no longer have. To get round this, use your file manager or SFTP to rename that plugin’s folder in wp-content/plugins (for example wordfence to wordfence-off). This deactivates it. Log in, rename the folder back, reactivate the plugin, then unblock yourself or reset two-factor authentication in its settings.
5. The login page keeps reloading
If you enter the right password and just land back on the login page, try these in order:
- Clear your browser’s cookies and cache for the site, or try a private window.
- Check the site address settings. In phpMyAdmin, open the
wp_optionstable and look atsiteurlandhome. Both should match your real address exactly, includinghttps://and whether or not you usewww. - As a temporary fix, you can set the addresses in
wp-config.php:define( 'WP_HOME', 'https://yourdomain.co.uk' ); define( 'WP_SITEURL', 'https://yourdomain.co.uk' ); - Rename
.htaccessin the site root to rule out a broken redirect rule. You can regenerate it afterwards from Settings > Permalinks by clicking Save.
6. You’ve forgotten your custom login address
Plugins such as WPS Hide Login move the login page to a secret address. If you have forgotten it, rename that plugin’s folder in wp-content/plugins. The normal /wp-login.php address will work again.
7. Your admin account has been deleted or downgraded
If your account is missing, or has lost its administrator role, and nobody on your team changed it, treat it as a possible hack. You can create a new administrator with WP-CLI:
wp user create newadmin [email protected] --role=administrator
Then follow our guide on what to do if your WordPress site is hacked, because whoever removed your access may still be in the site.
Is it actually a lockout?
If you see a blank white page or “There has been a critical error on this website” instead of the login form, the problem is a crash rather than a lockout. See how to fix the WordPress white screen of death. “Error establishing a database connection” usually means a database or hosting problem, and is worth raising with your host.
Still locked out?
Page Guard’s London-based developers can get you back into WordPress and find out what caused the lockout. The diagnosis is free, one-off fixes start from £55, and if we can’t fix it you get a full refund. Get emergency WordPress support or call 020 3376 1925.