Skip to content

Instantly share code, notes, and snippets.

@dalethedeveloper
Created June 20, 2013 19:56
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 dalethedeveloper/5826076 to your computer and use it in GitHub Desktop.
Save dalethedeveloper/5826076 to your computer and use it in GitHub Desktop.
WP Network Site Move SQL
-- Make sure ZZZ is the number of the site in the `wp_sites` table. Your root site has no entry so it would be `wp_posts`
-- but your first site in the Network Admin > Sites list would be `wp_1_posts`
-- OLDSITE.TLD and NEWSITE.TLD should be complete FQDNs. If a site was www.olddomain.com make sure you replace it
-- completely so that you don't end up with www.www.newsite.com
UPDATE wp_ZZZ_postmeta SET meta_value = replace(meta_value,'OLDSITE.TLD','NEWSITE.TLD') WHERE meta_value like '%OLDSITE.TLD%';
UPDATE wp_ZZZ_posts SET guid = replace(guid, 'OLDSITE.TLD','NEWSITE.TLD');
UPDATE wp_ZZZ_posts SET post_content = replace(post_content, 'OLDSITE.TLD','NEWSITE.TLD');
-- Close comments on all existsing posts and pages
UPDATE wp_ZZZ_posts SET ping_status = 'closed', comment_status = 'closed' WHERE post_type IN ('post,'page');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment