WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I consider myself fairly versed in this matter, however I've recently had a rash of issues when moving sites. I am able to successfully move the site, edit wp-config.php, move the database, etc.

Once I've moved the database, I then execute these queries:

UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');

This correctly updates all of my links, image references, etc. - HOWEVER I end up with a different problem:

What happens is that some widgets break (examples are the WP Text Widget, as well as the add-on widget WYSIWYG Widget). Completely. As in the widget does not appear under the sidebar any longer, and I have to completely reconstruct them (the plugins are fine, it's just the widget disappears from the sidebars).

I've searched around WP-SO, and I've seen comments that warn against this method of updating the db, but what I'd like to know is if there is a way to resolve this, and what that way is.

share|improve this question
up vote 2 down vote accepted

There are some instances of serialized data in the database, notably in things like widget options, that become invalidated if you do a blind search-and-replace without accounting for different string lengths. You might try a tool like this one to do a search and replace that also handles serialized data: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

share|improve this answer
Beautiful solution. Thank you! – cale_b Mar 23 '12 at 19:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.