Skip to content

Instantly share code, notes, and snippets.

@fasterwp
Created June 11, 2018 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fasterwp/322d4f37341bc5aecff0868f5d079f8b to your computer and use it in GitHub Desktop.
Save fasterwp/322d4f37341bc5aecff0868f5d079f8b to your computer and use it in GitHub Desktop.
Replace old domain with new domain in database
UPDATE wp_options SET option_value = REPLACE(option_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET guid = REPLACE(guid, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'ORIGINAL_URL', 'NEW_URL');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment