Created
September 10, 2015 14:39
-
-
Save nielsenrc/57876fd9e33f23278008 to your computer and use it in GitHub Desktop.
Wordpress | Change URL in Wordpress Database During Domain Change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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