Created
March 11, 2011 18:58
-
-
Save arnorhs/866373 to your computer and use it in GitHub Desktop.
The SQL you need to execute to change a Wordpress site from one host to the other
This file contains 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
# Update the options for site settings: | |
UPDATE wp_options | |
SET | |
option_value = replace( | |
option_value, | |
'http://oldsite.com/path', | |
'http://spankingnew.com/otherpath' | |
) | |
WHERE | |
option_name = 'home' | |
OR | |
option_name = 'siteurl'; | |
# Update the post contents and the post slugs/urls at the same time: | |
UPDATE wp_posts | |
SET | |
post_content = replace( | |
post_content, | |
'http://oldsite.com/path', | |
'http://spankingnew.com/otherpath' | |
), | |
guid = replace( | |
guid, | |
'http://oldsite.com/path', | |
'http://spankingnew.com/otherpath' | |
); |
This file contains 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
<?php | |
// In /wp-config.php, add this: | |
define('WP_HOME','http://spankingnew.com/otherpath'); | |
define('WP_SITEURL','http://spankingnew.com/otherpath'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment