Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vunb/3137113f0b749c6c30fcd17f738292f7 to your computer and use it in GitHub Desktop.
Save vunb/3137113f0b749c6c30fcd17f738292f7 to your computer and use it in GitHub Desktop.

Revisions

  1. @chuckreynolds chuckreynolds revised this gist Sep 24, 2014. 2 changed files with 9 additions and 9 deletions.
    9 changes: 0 additions & 9 deletions wordpress-change-domain-migration.php
    Original file line number Diff line number Diff line change
    @@ -1,9 +0,0 @@
    UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

    UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');

    UPDATE wp_links SET link_url = replace(link_url, 'http://olddomain.com','http://newdomain.com');

    UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com','http://newdomain.com');

    UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
    9 changes: 9 additions & 0 deletions wordpress-change-domain-migration.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    SET @oldsite='http://oldsite.com';
    SET @newsite='http://newsite.com';
    UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
    UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
    UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
    UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);

    /* only uncomment next line if you want all your current posts to post to RSS again as new */
    #UPDATE wp_posts SET guid = replace(guid, @oldsite, @newsite);
  2. @chuckreynolds chuckreynolds created this gist Jul 18, 2013.
    9 changes: 9 additions & 0 deletions wordpress-change-domain-migration.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

    UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');

    UPDATE wp_links SET link_url = replace(link_url, 'http://olddomain.com','http://newdomain.com');

    UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com','http://newdomain.com');

    UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');