Fixing WordPress 'Cookies Blocked' Error After Changing Domain

wordpress domain changecookies blocked errorupdate wordpress databasewp-config.php configurationwordpress 301 redirect
Published·Modified·

Recently, a user attempted to change their domain name by directly modifying the new domain in the backend under Settings > General, which resulted in being unable to log in to the backend. WordPress displayed the error: "Cookies are blocked or your browser does not support them. To use WordPress, you must enable cookies."

cookies

Directly changing the domain in the settings cannot achieve a complete domain replacement. You must also replace the old domain with the new domain in the database. Please use the following three SQL statements to update your database. Here, http://www.zouxiuping.com represents the old domain, and http://www.xiaoz.me represents the new domain.

UPDATE wp_options SET option_value = REPLACE( option_value, 'http://www.zouxiuping.com', 'http://www.xiaoz.me' ) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = REPLACE( post_content, 'http://www.zouxiuping.com', 'http://www.xiaoz.me' ) ;
UPDATE wp_posts SET guid = REPLACE( guid, 'http://www.zouxiuping.com', 'http://www.xiaoz.me' ) ;

If the "Cookies are blocked" error persists after completing the above steps, you can modify the WordPress configuration file to resolve the issue. Locate the wp-config-sample.php file in the website root directory, fill in the database information as required, and save it as wp-config.php (ensure the format is UTF-8). Finally, upload and overwrite the original wp-config.php.

// ** MySQL settings - Specific information from the host you are using ** //
/** WordPress database name */
define('DB_NAME', 'database_name_here');

/** MySQL database username */
define('DB_USER', 'username_here');

/** MySQL database password */
define('DB_PASSWORD', 'password_here');

/** MySQL host */
define('DB_HOST', 'localhost');

Final Note: Changing the domain carries certain risks and is not recommended for beginners, as it may cause website errors or indexing issues. However, please ensure you perform a 301 redirect operation, or refer to the article WordPress Domain Change Precautions for more details.