Moving a WordPress Website

WordPress is great don’t get me wrong, but the fact that they don’t seem to think or care that it’s possible that you’ll want to develop on a different domain to the one you finally take live annoys me. Drupal requires almost zero config to take from to just WordPress on the other hand seems to be a lot of work.

There are a couple of guides in the Codex if you’re looking to move a site, but I thought I’d add a help piece of code (with a warning) that I use every single time.

UPDATE wp_posts SET post_content = replace(post_content,"","");
UPDATE wp_posts SET guid = replace(guid,"","");
UPDATE wp_options SET option_value = replace(option_value,"","");

My warning is to remember to copy any ‘Text’ widgets your site has before proceeding. For some reason if you change the links in a text widget and the new domain length is different to the original it will delete the text widget’s content completely.

Good luck.