About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
The login page shows "Error: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress." when WordPress could not find its test cookie in the login request. The user name and password are not the problem. WordPress sets a cookie when it shows the login form and looks for it when the form comes back, so the message means the browser did not keep or send that cookie. The usual causes are a browser that blocks cookies, a COOKIE_DOMAIN that does not match the address in use, or a login page reached over a different scheme from the one WordPress expects.
What the error means
In WordPress 6.7.1, wp-login.php sets a cookie named by the constant TEST_COOKIE, which default-constants.php defines as wordpress_test_cookie, each time the login page is requested. The login form carries a hidden field named testcookie. When the form is posted with that field, no test cookie arrives and the sign-in set no logged-in cookie, the code returns the error "Error: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress."
The developer handbook describes the cookie as one "to probe the ability of WordPress to set cookies" and says that if writing it fails, you get this message.
wp-login.php has a second, different message: "Cookies are blocked due to unexpected output." In 6.7.1 it is chosen when headers_sent() is true, meaning something was printed before WordPress could send its headers. That is another fault and is not fixed by anything in the browser.
Two details of how the test cookie is set matter. It is set with the domain COOKIE_DOMAIN, and with the Secure attribute when the login address that WordPress builds starts with https. RFC 6265 says that when the cookie names a domain that the request host does not match, the browser must "Ignore the cookie entirely", and that a cookie with the Secure attribute is sent only if the request "is transmitted over a secure channel". Under the first rule the cookie is never stored. Under the second it is not sent back over plain http. Either way the login request arrives without it.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| The browser blocks cookies for the site | The message on every login from that browser | Login works in a private window or another browser |
COOKIE_DOMAIN in wp-config.php names a host other than the one in the address bar |
Started after a move or a rename | The define( 'COOKIE_DOMAIN', ... ) line differs from the host in the address bar |
The page was reached over http while WordPress builds an https login address |
The page address starts with http |
The Set-Cookie line carries the Secure attribute, but the page address starts with http |
| Cookies or a server cache left from before a move | Started after a move | The handbook's advice for this case is to delete the cookies and the server cache; see the fix below |
| Output before the headers | The other message: "Cookies are blocked due to unexpected output." | The text names unexpected output, not the browser |
Prove the cause before changing anything
All of these steps only read.
1. Match the message. The text must say "blocked or not supported by your browser". If it says "unexpected output", the cause is in the site's code, not the browser.
2. Try a separate browsing session. Chrome's help says that when you open an Incognito window, "Chrome starts a separate browsing session". Open one and sign in. If it works there, the fault is in the first browser's cookies or settings.
3. Read the login response. Open the browser's Network panel, tick Preserve log, load the login page and select the request for wp-login.php. In the Headers tab, scroll to Response Headers and look for a Set-Cookie line for wordpress_test_cookie. Google's reference says that for a cookie that was blocked, you select the request, open its Cookies tab and hover over the information icon to see the reason.
4. Compare the host names. Read these lines in wp-config.php and compare them with the host in the address bar. This only reads the file.
grep -n -e COOKIE_DOMAIN -e WP_HOME -e WP_SITEURL wp-config.php
The POSIX grep page defines -n as preceding each output line by its line number, and -e as a pattern to search for, so the command prints every line that holds any of the three names.
No lines mean none of the three names is in the file. No COOKIE_DOMAIN line means WordPress uses its default, an empty string (6.7.1 default-constants.php). RFC 6265 (sections 5.3 and 5.4) says that a cookie set with no domain is kept as a host-only cookie and sent back only to the host that set it. A COOKIE_DOMAIN line with another host name is the mismatch.
5. Compare the scheme. In the same Set-Cookie line, look for the word Secure. Compare it with the start of the address bar.
Fix
The browser blocks cookies
The handbook says that "in order to log in to your WordPress site, you must have cookies enabled in your browser", and points to each browser's own cookie page for Chrome, Firefox, Edge, Safari, Opera and Brave. Change the setting there, not on the server. A private window or a different browser is a way to sign in while you do.
The cookies are stale after a move
The handbook says that if you get the message after moving your website, "always try to delete your cookies and if you are using a caching plugin, the server cache". The browser part is below. How a server cache is emptied depends on the caching plugin or the host.
First save the current state: write down the address of the site and any preferences on it that you want to set again, because the cookies themselves cannot be restored.
Risk: the next steps delete this site's cookies from the browser and cannot be undone. Chrome's page says that "you may get signed out of sites that remember you" and that "Your saved preferences can also be deleted."
In Chrome, select More, then Settings, then Privacy and security, then Third-party cookies, then See all site data and permissions. Search for the site's name, select Delete to the right of it, and select Delete again to confirm.
To undo it: deleted cookies cannot be brought back. Sign in to the site again and set the preferences you wrote down.
COOKIE_DOMAIN names the wrong host
The handbook shows define( 'COOKIE_DOMAIN', 'www.example.com' ); for sites with unusual domain setups, and says the domain set in the cookies for WordPress can be specified that way.
First save the current state: keep a copy of wp-config.php in the folder above the web folder, named with today's date.
Risk: the copy of wp-config.php holds the same database password and keys as the original, so keep it out of the web folder and delete it when you no longer need it.
cp -p /var/www/example.com/htdocs/wp-config.php /var/www/example.com/wp-config.php.2026-12-04
Risk: the next edit changes the domain that every WordPress cookie is set for.
If the file has no COOKIE_DOMAIN line, there is nothing to change here, because WordPress then uses its empty default. If it has a line naming another host, set it to the host name in the address bar, in wp-config.php:
define( 'COOKIE_DOMAIN', 'www.example.com' );
To undo it: copy the saved file back over wp-config.php.
Risk: copying the saved file back overwrites wp-config.php, so it discards the edit and any other change made to the file since the copy. The login fault returns if the old value was the cause.
cp -p /var/www/example.com/wp-config.php.2026-12-04 /var/www/example.com/htdocs/wp-config.php
Then load the login page to see the state you went back to.
The scheme does not match
In 6.7.1, wp-login.php sets the test cookie with the Secure attribute when wp_login_url() starts with https. RFC 6265 says a Secure cookie is sent back only over a secure channel. So if step 5 shows Secure in the Set-Cookie line while the address bar starts with http, the test cookie is not sent back and the message appears. How WordPress reads the forwarded scheme is covered in ERR_TOO_MANY_REDIRECTS after turning on HTTPS behind a proxy or CDN.
Example (illustrative): Example Pty Ltd moves its shop from shop.example.com to www.example.com on web01. After the move, the login page at https://www.example.com/wp-login.php shows the cookie message. The Network panel shows a Set-Cookie line for wordpress_test_cookie that names shop.example.com, and the Cookies tab marks it as blocked. wp-config.php still has COOKIE_DOMAIN set to shop.example.com. The administrator saves wp-config.php, changes the line to www.example.com, and the next login works.
Confirm the fix
- Load the login page in a normal window and sign in. The cookie message should not appear.
- Repeat the Network panel check: the
Set-Cookieline forwordpress_test_cookieshould name the host in the address bar. - Sign in from a second browser as well, to be sure the fix does not depend on one browser's saved state.
What to watch afterwards
- After a domain change, an HTTPS change or a new proxy or cache, sign in from a browser that has no old cookies for the site.
Read next
Related articles you may want next.
- HostingWordPress "Updating failed. The response is not a valid JSON response.": read what the save request actually receivedWordPress 'Updating failed. The response is not a valid JSON response.' Read the save request's response, find what replaced the JSON, then fix it.Read article
- TroubleshootingERR_TOO_MANY_REDIRECTS after turning on HTTPS behind a proxy or CDNRedirect loop after enabling HTTPS behind a proxy or CDN? Trace it with curl -I -L, then fix X-Forwarded-Proto handling or the proxy encryption mode.Read article
- HostingWooCommerce "Sorry, your session has expired. Return to shop" at the classic checkoutWooCommerce checkout says Sorry, your session has expired. Return to shop. Find the lost cookie, cached checkout page or timeout behind it, then fix it.Read article
Risks and limits
- These commands have not been run or lab-tested.
- Cookie handling differs between browsers and versions. The Chrome menu names are as the help pages show them; other browsers have their own.
- Deleting cookies signs you out of the site and cannot be undone.
- The paths in the commands are examples.
- A fault with the login cookie is separate from a REST error in the editor after sign-in: see WordPress "Updating failed. The response is not a valid JSON response.": read what the save request actually received.
Sources
- Cookies — WordPress Developer Resources (Advanced Administration Handbook), page dated 14 October 2026, accessed 4 December 2026
- Editing wp-config.php — WordPress Developer Resources (Advanced Administration Handbook), page dated 14 October 2026, accessed 4 December 2026
- RFC 6265: HTTP State Management Mechanism — IETF, April 2011, accessed 4 December 2026
- Network features reference — Chrome for Developers, page dated 16 July 2024, accessed 4 December 2026
- Browse in Incognito mode — Google Chrome Help, no date shown, accessed 4 December 2026
- Delete, allow, and manage cookies in Chrome — Google Chrome Help, no date shown, accessed 4 December 2026
- cp — The Open Group Base Specifications Issue 7, 2018 edition (POSIX), accessed 4 December 2026
- grep — The Open Group Base Specifications Issue 7, 2018 edition (POSIX), accessed 4 December 2026
- wordpress-develop/src/wp-login.php at 6.7.1 — WordPress source at a fixed tag, no date shown, accessed 4 December 2026
- wordpress-develop/src/wp-includes/default-constants.php at 6.7.1 — WordPress source at a fixed tag, no date shown, accessed 4 December 2026
This article was originally published on .