Skip to content

Instantly share code, notes, and snippets.

@dillonhafer
Created July 7, 2014 14:18
Show Gist options
  • Save dillonhafer/08f2973235e001d66351 to your computer and use it in GitHub Desktop.
Save dillonhafer/08f2973235e001d66351 to your computer and use it in GitHub Desktop.
SET @oldsite = 'http://www.oldsite.com';
SET @newsite = 'http://www.newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, @oldsite, @newsite);
UPDATE wp_posts SET post_content = REPLACE (post_content, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, @oldsite, @newsite);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment