More fixes

The WordPress login page keeps refreshing and sends you back to the login

You type the right username and password, press Log In, and the same login page comes back: empty fields, no error, no dashboard. Your password is not the problem. WordPress did log you in, but the browser never got to keep the login cookie, or kept it for a different address than the one the dashboard lives on, so the dashboard sees a stranger and sends you back. Below is a rebuilt example (not a real client), then the order of steps that gets you back in without breaking anything.

What the owner sees after pressing Log In

maplelanedental.example/wp-login.php

What the checks found


  

First: a loop, or a wrong password?

The safe order of steps

  1. Rule out the browser in one minute. Open a private window and log in there. If that works, delete this site's cookies in your normal browser (the padlock or site icon next to the address, then cookies or site data) and log in again. Done.
  2. Back up before touching files. In the host's control panel, take a backup, or at least download copies of wp-config.php and .htaccess with the file manager. Everything below is changed through the host's file manager or phpMyAdmin, because the dashboard is the thing you cannot reach.
  3. Check the two site addresses. This is the most common cause, usually after adding SSL (moving to https://) or moving hosts. In phpMyAdmin, open the wp_options table (the prefix may differ) and read the rows siteurl and home. They must match the address you actually use, exactly: same https or http, same www or no www. If they disagree with each other or with the address bar, the cookie is set for one address and the dashboard checks it on the other.
  4. Fix them the reversible way: add two lines to wp-config.php, just above the line that says /* That's all, stop editing! */:
    define( 'WP_HOME', 'https://www.example.com' );
    define( 'WP_SITEURL', 'https://www.example.com' );
    using your real address, with no slash at the end. These override the database, and deleting them puts things back. Once you are in, set the same address under Settings, General (the two fields will be greyed out while the lines are there), then you can remove the lines. Do not change the address to one your SSL certificate does not cover.
  5. Look for a stray cookie setting. If wp-config.php has a line defining COOKIE_DOMAIN (often left behind by a move or an old multisite setup), put // in front of it and try again.
  6. Take the cache out of the login. A caching plugin, the host's cache or a CDN rule such as Cloudflare "Cache Everything" can serve a stored copy of the login page or the dashboard redirect. Purge every cache, and make sure /wp-login.php and /wp-admin/ are excluded from caching.
  7. Switch the plugins off without the dashboard. Security, login-page, redirect and membership plugins are the usual suspects. In the file manager, rename wp-content/plugins to plugins-off and try to log in. If it works, rename it back, then rename the plugins' own folders one at a time to find the one causing it. If it does not, rename it back and do the same with the active theme's folder (WordPress falls back to a default theme).
  8. Reset .htaccess if the site was moved or a plugin wrote rules into it: rename it to .htaccess-old, log in, then go to Settings, Permalinks and press Save to write a clean one. (On nginx hosts there is no .htaccess; skip this.)
  9. If the password really is lost and the reset email never comes: the host's control panel often has a "WordPress toolkit" with a reset button. Without one, it can be set in phpMyAdmin (wp_users, your row, user_pass, function MD5, a new password); WordPress accepts it once and re-stores it with its stronger hash at your next login. Then fix the email: a site that cannot send a password reset also loses its contact form mail.
  10. Test logging in from a private window and from your phone, then the home page and the contact form.

Common causes and what each one needs

What you findWhat it meansUsual fix
Works in a private window, not in your usual browserAn old or broken cookie in that browserDelete the site's cookies, log in again
siteurl and home differ (http vs https, www vs none)The login cookie is set for one address, checked on anotherWP_HOME and WP_SITEURL in wp-config.php, then Settings, General
COOKIE_DOMAIN defined in wp-config.phpThe cookie is issued for a domain the site no longer usesComment the line out
Started after turning on a cache, CDN or Cloudflare ruleA stored copy of the login or dashboard is being servedPurge; exclude /wp-login.php and /wp-admin/
Logs in fine with the plugins folder renamedA plugin (often security or redirect) is bouncing youFind it folder by folder; update, reconfigure or replace it
"Cookies are blocked" plus "headers already sent" in the error logSomething prints output before WordPress sends the cookieRemove the blank line or space before <?php in the file the log names

What not to do

If you can reach the host's file manager, the steps above usually get you back in within half an hour. If you are locked out of the host's panel too, or the site needs to be edited today, that is what the box below is for. Related: "too many redirects" is the same address mix-up taken one step further, and a "critical error on this website" after you get in usually means a plugin or theme update failed.