Wordpress admin login cookies blocked error after moving servers

Wordpress admin login cookies blocked error after moving servers

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Wordpress admin login cookies blocked error after moving servers

Moving a WordPress site from olddomain.com to newdomain.com often involves more than just updating DNS records and file paths. In this specific scenario, defining WP_HOME and WP_SITEURL in wp-config.php successfully resolved URL discrepancies across the frontend, but it introduced a critical session management failure in the admin area. The error message "Cookies are blocked or not supported" appearing even after clearing browser cookies indicates that WordPress cannot maintain a persistent session between the login request and the dashboard redirect.

The core issue stems from how WordPress handles the testcookie flag during authentication. When you attempt to log in, WordPress sets a cookie named wp-postpass_{$user_login} (or similar depending on the version) to verify that the browser is accepting cookies. If this verification fails, the system assumes the client has disabled cookies entirely, which is a security requirement for admin access. However, the error persists even when cookies are enabled in the browser.

The attempted workaround of commenting out the conditional check in wp-login.php (lines 744-747) bypasses the verification step but does not solve the underlying session state issue. By removing the check that validates the testcookie flag, WordPress proceeds to sign you in and immediately attempts to redirect you to wp-admin. If the server-side session ID generated during the login response cannot be stored or retrieved by the client due to a mismatch in how the cookie path or domain is interpreted, the browser will appear to have "blocked" cookies. This results in the redirect loop observed at http://myapp.com/wp-login.php?redirect_to=...&reauth=1. The reauth=1 parameter signals that WordPress detected an invalid session during the redirect attempt and is forcing a re-authentication, creating a cycle where the user never successfully transitions to the dashboard.

The most likely culprit in this migration scenario is the configuration of WP_HOME and WP_SITEURL. While these constants are useful for overriding URL settings without modifying theme files, they can interfere with cookie domain attributes if not set correctly relative to the actual server hostname. If the cookie path defaults to / but the site is accessed via a subdomain or if the server sends headers that restrict the cookie scope, the session ID will fail to persist.

To resolve this without editing core files like wp-login.php, you should inspect the wp-config.php settings more closely. Ensure that WP_HOME and WP_SITEURL are set to the full URL including the protocol (http:// or https://). Mismatches between HTTP_HOST in PHP, the defined constants, and the actual browser URL can cause browsers to reject cookies due to security policies regarding mixed content or domain mismatch.

Additionally, verify that your server is not sending conflicting headers. Check the response headers for Set-Cookie. If the cookie attributes (like Path, Domain, or Secure) are missing or restrictive, the browser might silently ignore the session cookie while other cookies work fine. For example, if the site is served over HTTPS but the cookie is set without the Secure flag, modern browsers may block it in certain contexts, though this specific error usually points to a stricter blocking mechanism.

If the issue persists after correcting these constants, consider clearing all cookies specifically for the domain in your browser settings and ensuring that no strict content security policies or third-party ad blockers are interfering with the wp-login.php endpoint. The redirect loop confirms that the session initialization is failing silently until the system forces a re-authentication, which then repeats the same failure path. Correcting the URL constants to ensure they match the exact hostname used in the browser request usually resolves the session storage conflict without needing to disable security checks in core files.

Our network