Skip to content

Instantly share code, notes, and snippets.

@rkmax
Created August 23, 2019 19:33
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 rkmax/cce4541557a18e91c277d8bfeb4123fd to your computer and use it in GitHub Desktop.
Save rkmax/cce4541557a18e91c277d8bfeb4123fd to your computer and use it in GitHub Desktop.
Safe domain transition for wordpress
set @old_domain = '';
set @new_domain = '';
-- Update post
UPDATE wp_posts
SET guid = replace(guid, @old_domain, @new_domain),
post_content = replace(post_content, @old_domain, @new_domain);
UPDATE wp_postmeta
SET meta_value = replace(meta_value, @old_domain, @new_domain);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment