Skip to content

Instantly share code, notes, and snippets.

@nielsenrc
Created September 10, 2015 14:39
Show Gist options
  • Save nielsenrc/57876fd9e33f23278008 to your computer and use it in GitHub Desktop.
Save nielsenrc/57876fd9e33f23278008 to your computer and use it in GitHub Desktop.
Wordpress | Change URL in Wordpress Database During Domain Change
// turn privacy setting off in Wordpress
UPDATE wp_options SET option_value = "1" WHERE option_name = "blog_public";
//change home and siteurl values
UPDATE wp_options SET option_value = "http://www.domain2.com" WHERE option_name = "home";
UPDATE wp_options SET option_value = "http://www.domain2.com" WHERE option_name = "siteurl";
// sweep options, post_content, and guid for references to old url
UPDATE wp_options SET option_value = REPLACE(option_value,'www.domain1.com','www.domain2.com');
UPDATE wp_posts SET post_content = REPLACE(post_content,'www.domain1.com','www.domain2.com');
UPDATE wp_posts SET guid = REPLACE(guid,'www.domain1.com','www.domain2.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment