Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ptahdunbar/4335595 to your computer and use it in GitHub Desktop.
Save ptahdunbar/4335595 to your computer and use it in GitHub Desktop.
Please note: 1) this gists does not take into account serialized data that plugins may have added. 2) also does not support WordPress multisite.
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://wp.old', 'http://wp.new');
UPDATE wp_posts SET guid = REPLACE(guid, 'http://wp.old', 'http://wp.new');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http://wp.old', 'http://wp.new');
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://wp.old', 'http://wp.new')
WHERE option_name = 'home' OR option_name = 'siteurl';
-- Optional, uncomment the following lines if you left comments on your site.
-- UPDATE wp_postsmeta SET comment_author_email = REPLACE(comment_author_email, '@wp.old', '@wp.new');
-- UPDATE wp_postsmeta SET comment_author_url = REPLACE(comment_author_url, 'http://wp.old', 'http://wp.new');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment