Explainers · Explainer
What Is Wordpress_test_cookie in WordPress? Explained

Short answer
The wordpress_test_cookie is a temporary session cookie that WordPress sets on the login page. It checks that your browser accepts cookies before you log in, holds no personal data, and triggers the cookies are blocked error when it does not come back.
Key takeaways
- It is a session cookie set on the WordPress login page.
- It only checks that your browser accepts cookies.
- It holds a fixed text value and no personal data.
- A missing test cookie triggers the cookies are blocked error.
- Address mismatches, COOKIE_DOMAIN, caching and stray output are common causes.
What is wordpress_test_cookie?
The wordpress_test_cookie is a small temporary cookie that WordPress sets on the login page to check whether your browser accepts cookies before it lets you log in.
It does not identify you, track you, or store your password. Its only job is to confirm that cookies work in your browser.
A cookie is a small piece of text a website asks your browser to store and send back on later requests. MDN has a clear primer on how HTTP cookies work if you want the technical background.
WordPress needs cookies to keep you logged in. If your browser blocks them, the login would fail silently. The test cookie lets WordPress catch that early and show a clear error instead.
How does the test cookie work?
When you open the login page, WordPress sends the test cookie to your browser, and when you submit the form it checks that the cookie came back; if not, it shows a cookie error.
The steps look like this:
- You visit wp-login.php or your custom login address.
- WordPress sends a cookie named wordpress_test_cookie with a simple value, usually the text WP Cookie check.
- You type your username and password and click Log In.
- Your browser sends the login form along with any cookies it saved.
- WordPress looks for the test cookie in that request.
- If it is there, the login continues. If it is missing, you see an error.
The cookie name is set by a constant called TEST_COOKIE. WordPress defines it in the wp_cookie_constants function, along with the other cookie names and paths.
What does the test cookie contain?
It contains only a short fixed text value, no personal data, and it is a session cookie that your browser deletes when you close it.
Here is a quick summary:
| Property | Value |
|---|---|
| Name | wordpress_test_cookie |
| Value | A fixed check string such as WP Cookie check |
| Set on | The login page |
| Lifetime | Session only (removed when the browser closes) |
| Purpose | Confirms the browser accepts cookies |
| Personal data | None |
Because it holds nothing about you, it is treated as a strictly necessary cookie. It exists only so the login form can work.
What other cookies does WordPress set?
After a successful login, WordPress sets authentication cookies that keep you signed in, a logged-in cookie, and settings cookies that remember dashboard preferences.
The WordPress cookies documentation lists them. In short:
- wordpress_[hash] stores your authentication details for the admin area.
- wordpress_logged_in_[hash] tells WordPress you are logged in across the site.
- wp-settings-{user ID} and wp-settings-time-{user ID} remember dashboard layout choices.
- comment_author cookies remember a commenter's name and email if they agree.
Visitors who never log in or comment usually get none of these. Plugins such as WooCommerce, analytics tools and ad scripts add their own cookies on top.
What does the cookie error mean?
The message Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress. means WordPress did not receive the test cookie back when you tried to log in.
Sometimes the cause really is your browser. Often, though, the browser is fine and something on the site stops the cookie from being set or read.
A related message reads Cookies are blocked due to unexpected output. That points to a site problem, not a browser one. Some code printed text before WordPress could send its headers.
What causes the test cookie to fail?
The usual causes are browser privacy settings, a wrong site address, a bad cookie domain setting, caching of the login page, or stray output from a theme or plugin.
Work through these in order:
- Browser blocks cookies. Strict privacy settings, some extensions, or private browsing modes can refuse cookies. Try another browser first.
- Site address mismatch. If WordPress Address and Site Address use different domains, or one has www and the other does not, the cookie can be set for the wrong host.
- HTTP and HTTPS mix. A login page on HTTPS with a site address on HTTP can confuse cookie handling. Our guide to fixing mixed content warnings covers the move to full HTTPS.
- Wrong COOKIE_DOMAIN. A COOKIE_DOMAIN line in wp-config.php that does not match your real domain breaks cookies. This often happens after a migration.
- Cached login page. A page cache or CDN that caches wp-login.php can serve a page without the cookie header.
- Unexpected output. Blank lines or spaces after a closing PHP tag in a plugin, theme or wp-config.php file stop headers from being sent. Our page on the headers already sent error explains how to find it.
- Security plugins. Some firewall or login protection plugins change how the login page works and can clash with the check.
How do you fix the cookie error on the login page?
Clear your browser cookies, try another browser, then check your site address settings, remove any wrong COOKIE_DOMAIN line, exclude the login page from caching and test for plugin conflicts.
Step by step:
- Clear cookies and cache for the site in your browser, then reload the login page.
- Try another browser or a different device. If that works, the problem is local to your first browser.
- Check the site addresses. In Settings > General, make sure WordPress Address and Site Address match exactly. If you cannot log in, you can set WP_HOME and WP_SITEURL in wp-config.php.
- Look at wp-config.php. Remove or correct any COOKIE_DOMAIN, COOKIEPATH or ADMIN_COOKIE_PATH lines that came from an old setup.
- Purge caches in your caching plugin, server cache and CDN. Make sure the login page is excluded from page caching. Our guide on how to clear cache in WordPress covers each layer.
- Disable plugins. Rename the plugins folder over FTP or your file manager to switch them all off. Our guide to deactivating all plugins without admin access shows the steps.
- Switch to a default theme by renaming your theme's folder, then try again.
If the login page keeps reloading instead of showing an error, the cause is often the same. See our guide on fixing a login page that keeps refreshing.
Is there a code fix for the test cookie error?
Some old forum answers suggest forcing the test cookie with code in wp-config.php or a plugin, but that hides the symptom and should only be a last resort after finding the real cause.
The typical snippet sets the cookie manually with PHP's setcookie function before WordPress loads. It can get you back into the dashboard.
The problem is that if WordPress cannot set its own test cookie, it will often struggle to set the login cookies too. You may get in once and then be logged out again.
Fix the address, cookie domain, cache or plugin issue instead. Those are the root causes in almost every case.
Does wordpress_test_cookie need cookie consent?
It is generally treated as strictly necessary, because the login form cannot work without it, so it usually does not need opt-in consent, but you should list it in your cookie policy.
This is general information, not legal advice. Privacy rules differ by country, and you should check what applies to your site.
Under rules such as the EU ePrivacy Directive, cookies that are essential for a service the user asked for are normally exempt from consent. Logging in is such a service. The UK regulator's guidance on cookies and similar technologies explains the strictly necessary exemption.
Most consent plugins already classify WordPress login cookies as necessary. If you are setting one up, our guide on adding a cookie consent banner walks through the options.
Can you remove or rename the test cookie?
You can rename it by defining TEST_COOKIE in wp-config.php, but removing it brings little benefit and can make login problems harder to spot.
Some site owners rename it to make WordPress less obvious. Add a line such as this above the line that says to stop editing:
define( 'TEST_COOKIE', 'my_site_test' );
Renaming does not improve security in any real way. Attackers can spot WordPress through many other signs.
Leaving the default in place is the simplest choice. It is harmless, short-lived and only appears for people who visit the login page.
Why do you see wordpress_test_cookie in scanner reports?
Cookie scanners list it because they record every cookie they find, but its presence is normal and does not mean anything is wrong.
Scanners may label it as unclassified if they do not recognise it. You can mark it as necessary in your consent tool.
It only appears when a scanner or visitor loads the login page. On normal front-end pages, visitors who never log in usually do not receive it.
Frequently asked questions
Is wordpress_test_cookie safe?
Yes. It holds a fixed piece of text and nothing about you, your password or your browsing. It exists only to confirm that your browser accepts cookies, and it disappears when you close the browser because it is a session cookie.
Why do I get the cookies are blocked error when cookies are enabled?
The browser is often not the problem. A mismatch between the WordPress and site addresses, a wrong cookie domain setting in the config file, a cached login page, or stray output from a plugin or theme can all stop the cookie from being set or read.
Does wordpress_test_cookie track visitors?
No. It does not track anything. It is not tied to an account, it carries no unique ID, and it only appears for people who load the login page. Analytics and advertising cookies come from other scripts, not from this check.
Can I delete wordpress_test_cookie from my browser?
Yes, deleting it is harmless. WordPress simply sets it again the next time you open the login page. Clearing it along with other site cookies is often the first step when you see a login cookie error.
Do I need to list wordpress_test_cookie in my cookie policy?
It is good practice to list it as a necessary cookie. Most consent tools treat WordPress login cookies as strictly necessary, but rules differ by country, so check the guidance that applies to your site or ask a qualified adviser.
Sources
- Cookies WordPress Advanced Administration Handbook
- wp_cookie_constants() WordPress Developer Resources
- setcookie PHP Manual
- Using HTTP cookies MDN Web Docs
- Cookies and similar technologies Information Commissioner's Office
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


