Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Standalone WP -> Multisite migration queries
[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(
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