Skip to content

Instantly share code, notes, and snippets.

@rupert-ong
Created April 26, 2012 14:11
Show Gist options
  • Save rupert-ong/2499878 to your computer and use it in GitHub Desktop.
Save rupert-ong/2499878 to your computer and use it in GitHub Desktop.
Wordpress: Migrate Site (MySQL + Functions.php)
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldsite.com','http://www.newsite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldsite.com', 'http://www.newsite.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.oldsite.com', 'http://www.newsite.com');
update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment