Created
August 2, 2012 17:01
-
-
Save jseidl/3238715 to your computer and use it in GitHub Desktop.
Wordpress Migration
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
$old_site = 'http://example.com'; | |
$new_site = 'http://newsite.com'; | |
$wpdb_prefix = 'wp'; | |
# Replace slugs | |
update ${wpdb_prefix}_posts set guid = replace(guid, $old_site, $new_site); | |
# Replace title, excerpt and content | |
update ${wpdb_prefix}_posts set post_title = replace(post_title, $old_site, $new_site); | |
update ${wpdb_prefix}_posts set post_excerpt = replace(post_excerpt, $old_site, $new_site); | |
update ${wpdb_prefix}_posts set post_content = replace(post_content, $old_site, $new_site); | |
# Update site url | |
update ${wpdb_prefix}_options set option_value = '$new_site' where option_name ='home'; | |
update ${wpdb_prefix}_options set option_value = '$new_site' where option_name ='siteurl'; | |
# For serialized data | |
http://interconnectit.com/124/search-and-replace-for-wordpress-databases/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment