. : July 20, 2015 : .

Moving WordPress to New URL Cookies Error

I’ve recently been making some updates to a WordPress site I maintain. I wanted to make an exact copy of it, to test things out on before I released them into the wild.

I set out on the right track. I read through the relevant parts of the Moving WordPress page of the WordPress Codex, carefully followed the directions, went to log in to my new test site, and…

ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

Oh, come on!!!

I read the documentation, and did what it said for once in my life! All you have to do is put this code at the top of your functions.php file, right?

define('WP_HOME','http://newdomain.com');
define('WP_SITEURL','http://newdomain.com');

For whatever reason, the only thing that did, is keep me from getting sent back to the original production site when I tried to log in. After quite a bit of searching, I came upon datamafia’s answer on stackoverflow. I LOVE stackoverflow.

In his answer he said:

If migrating the DB : Check the database options table (probably wp_options) column “option_name” that values “siteurl” and “home” have the correct “option_value” for your site. “siteurl” is huge.

So, I busted out the MySQL goggles and had a peak. Sure enough, the home and siteurl were both set to the production site! So, I changed them with these little twin queries:

 UPDATE wp_options SET option_value = 'https://dev.site.com' WHERE option_name = 'siteurl' LIMIT 1;

UPDATE wp_options SET option_value = 'https://dev.site.com' WHERE option_name = 'home' LIMIT 1; 

I was then able to log in to my new dev site! Everything was smooth jazz and baby penguins from there on out.

Conclusion

It took me a while to get to the bottom of this, so I thought I’d write this post in case it helps someone else in a perilous quest to migrate a WordPress site.

References:

Categories:

Leave a Reply