Skip to content

Instantly share code, notes, and snippets.

@license2e
Forked from markrickert/MigrateWordpress.sql
Created May 31, 2017 08:20
Show Gist options
  • Save license2e/4d7bb15e31a80483dbe7ee2db3258eec to your computer and use it in GitHub Desktop.
Save license2e/4d7bb15e31a80483dbe7ee2db3258eec to your computer and use it in GitHub Desktop.
Wordpress Migration SQL Script
#Update the crucial options
UPDATE wp_options
SET option_value = 'http://newdomain.com'
WHERE option_name in ('siteurl', 'home');
#Make sure search engines can access the deployed site
UPDATE wp_options
SET option_value = 1
WHERE option_name = 'blog_public';
#Set the GUIDs to have the correct domain
UPDATE wp_posts
SET guid = REPLACE(guid, 'olddomain.com', 'newdomain.com');
#Update post content so internal links go to the correct place
UPDATE wp_posts
SET post_content = REPLACE(post_content, 'olddomain.com', 'newdomain.com');
#Make sure full paths in custom fields are updated.
UPDATE wp_postmeta
SET meta_value = REPLACE(meta_value, 'olddomain.com', 'newdomain.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment