Update all URLs in database except in serialized data fields

Updating URLs in the database can cause problems if you include those in serialized arrays.

These queries leave serialized arrays untouched:

UPDATE wp_options SET option_value = REPLACE(option_value, ‘http://devdomain.local‘, ‘http://livedomain.com‘) WHERE option_value NOT LIKE ‘%{%’;
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ‘http://devdomain.local‘, ‘http://livedomain.com‘) WHERE meta_value NOT LIKE ‘%{%’;
UPDATE wp_posts SET post_content = REPLACE(post_content, ‘http://devdomain.local‘, ‘http://livedomain.com‘) WHERE post_content NOT LIKE ‘%{%’; 

 

More info here:

http://wp-types.com/faq/how-do-i-migrate-a-wordpress-site-from-one-domain-to-the-other/

Leave a Comment