75 guides published Start a blog Fix my site How we test
FIX IT

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

#ActionTime
1Clear cookies, test in a private window1 min
2Confirm www/non-www consistency2 min
3Comment out cookie constants3 min
4Disable plugins from the filesystem3 min
5Add the forwarded-proto check3 min
6Regenerate salts5 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.

S

Sumit

Writes everything on TechMozz.

More in Fix It