wp-admin Redirect Loop After Logging In
You enter the right password, the page reloads, and you are back at the login form with no error. WordPress authenticated you and then failed to recognise the session on the next request.
The short version
- Clear cookies for the domain first. It resolves a large share of cases.
- A www/non-www mismatch breaks cookies reliably.
- Check the cookie domain constants in wp-config.php.
- Everything here is fixable from the filesystem.
1. Clear cookies for the domain
Not a browser cache clear — specifically the cookies for your site. A stale authentication cookie from a previous URL structure causes exactly this, and the fix takes ten seconds. Test in a private window to confirm.
2. www versus non-www
If WordPress is configured for example.com but you logged in at www.example.com, the cookie is set for one domain and read on the other. Check Settings → General, or if you are locked out, wp-config.php:
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
Then always visit the site at that exact form. Add a server-level redirect so the other form is never served.
3. Cookie constants
Check whether anything has defined cookie paths or domains in wp-config.php. These are sometimes added during a migration and then forgotten:
// comment these out if present, then retry
// define( 'COOKIE_DOMAIN', '.example.com' );
// define( 'COOKIEPATH', '/' );
// define( 'SITECOOKIEPATH', '/' );
// define( 'ADMIN_COOKIE_PATH', '/wp-admin' );
WordPress calculates sensible values automatically. An explicit value that no longer matches the site URL causes the loop.
4. Regenerate the salts
Corrupted or mismatched authentication keys invalidate sessions immediately after they are created. Generate a new set from the official salt generator and replace the block in wp-config.php:
define( 'AUTH_KEY', 'new random string' );
define( 'SECURE_AUTH_KEY', 'new random string' );
define( 'LOGGED_IN_KEY', 'new random string' );
define( 'NONCE_KEY', 'new random string' );
define( 'AUTH_SALT', 'new random string' );
define( 'SECURE_AUTH_SALT', 'new random string' );
define( 'LOGGED_IN_SALT', 'new random string' );
define( 'NONCE_SALT', 'new random string' );
Watch out
Changing the salts logs out every user, including you. That is the intended effect here, but on a membership site do it deliberately rather than as a first test.
5. Disable plugins from the filesystem
mv wp-content/plugins wp-content/plugins-off
Security plugins, membership plugins and anything that modifies login behaviour are the usual candidates. Reintroduce one at a time.
6. The SSL half-configuration
If FORCE_SSL_ADMIN is true but the server is not correctly reporting HTTPS, the secure cookie is set and then not sent back. This is the same underlying problem as the general redirect loop:
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] )
&& 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'] ) {
$_SERVER['HTTPS'] = 'on';
}
Order to try
| # | Action | Time |
|---|---|---|
| 1 | Clear cookies, test in a private window | 1 min |
| 2 | Confirm www/non-www consistency | 2 min |
| 3 | Comment out cookie constants | 3 min |
| 4 | Disable plugins from the filesystem | 3 min |
| 5 | Add the forwarded-proto check | 3 min |
| 6 | Regenerate salts | 5 min |
Common questions
Why does it work in a private window?
Because the private window has no stale cookie. That result confirms cookies are the cause.
I changed the site URL and now I am locked out
Hard-code WP_HOME and WP_SITEURL in wp-config.php to the correct value and clear cookies.
Could this be a hack?
It can be, if an attacker modified login behaviour. If nothing above explains it, audit the site.
Sumit
Writes everything on TechMozz.