Last active
December 29, 2015 14:29
-
-
Save aschweigert/f5dd03e04bea91797c0c to your computer and use it in GitHub Desktop.
Standalone WP -> Multisite migration queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[prefix] is needed to push the new users/usermeta values outside of the range already populated in the database, usually for a site with an ID of 40 using 40,000 will work pretty well (unless some of your sites have a lot of users). | |
UPDATE wp_users | |
SET ID = ID + [prefix] | |
// Add two columns to the end of the wp_users table, spam and deleted. Both are TINYINT(2). | |
UPDATE wp_usermeta | |
SET user_id = user_id + [prefix] | |
UPDATE wp_usermeta | |
SET umeta_id = umeta_id + [prefix] | |
UPDATE wp_usermeta | |
SET meta_key = 'wp_ID_user_level' | |
WHERE meta_key = 'wp_user_level' | |
UPDATE wp_usermeta | |
SET meta_key = 'wp_ID_capabilities' | |
WHERE meta_key = 'wp_capabilities' | |
UPDATE wp_ID_posts | |
SET post_author = post_author + [prefix] | |
// usually you'll need to update links to uploaded files in the posts table, depends on your configuration and version of WP | |
UPDATE wp_ID_posts | |
SET post_content = replace( | |
post_content, | |
'wp-content/uploads/', | |
'wp-content/blogs.dir/ID/files/' | |
) | |
UPDATE wp_ID_comments | |
SET user_id = user_id + [prefix] | |
In wp_ID_settings check siteurl, home, upload_url_path | |
In wp_ID_settings change (key) wp_user_roles to wp_ID_user_roles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment