Skip to content

Instantly share code, notes, and snippets.

@joshuadavidnelson
Created September 21, 2014 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joshuadavidnelson/8c77a2ac63cbd8509f1a to your computer and use it in GitHub Desktop.
Save joshuadavidnelson/8c77a2ac63cbd8509f1a to your computer and use it in GitHub Desktop.
Migrating database queries
UPDATE wp_options SET option_value = replace(option_value, 'http://oldurl', 'http://newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://oldurl', 'http://newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://oldurl', 'http://newurl');
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://oldurl','http://newurl');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment