Skip to content

Instantly share code, notes, and snippets.

@avit
Created April 28, 2010 22:16
Show Gist options
  • Save avit/382811 to your computer and use it in GitHub Desktop.
Save avit/382811 to your computer and use it in GitHub Desktop.
SELECT @old_domain:='stage.example.com';
SELECT @new_domain:='www.example.com';
UPDATE wp_postmeta SET
meta_value=REPLACE(meta_value, @old_domain, @new_domain);
UPDATE wp_posts SET
post_content=REPLACE(post_content, @old_domain, @new_domain),
post_excerpt=REPLACE(post_excerpt, @old_domain, @new_domain),
guid=REPLACE(guid, @old_domain, @new_domain);
UPDATE wp_options SET
option_value=REPLACE(option_value, @old_domain, @new_domain)
WHERE option_name='siteurl'
OR option_name='home';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment