How to import users with conflicting IDs into WP multisite network

Question

I’m setting up a Multisite network and I’ve got three sites I need to include into this network. The first two sites only have a couple of users, but as is the convention, users are assigned numerical IDs starting at 0 and counting up in the WordPress database.

I’m using the Import Export WordPress Users plugin to export the users from the original sites and import them into each sub-site respectively. I’m doing this so that when I import all the content with the WordPress importer, I can assign these users to the correct posts/pages, etc..

The problem is that after successfully importing the first couple of users from site A into my multisite, trying this same approach on site B tells me that these users already exist. I believe that’s because users from both sites share the same ID’s in the database.

enter image description here

So now I’m wondering how I can import these users from site B into my multisite network when they share IDs that are already in use in my multisite database? As is the case for multisite networks, all users for any sub-sites (including the Super-admin of the network) are stored in a single database table at the top level of the multisite network.

I imagine I have to do some SQL magic to change the IDs for users of site B before importing them into my multisite but I hesitate to start firing off SQL queries. I suppose I can update the IDs of the current couple of users sitting in my network users database table but will this break the link they have to their respective posts/pages?

Any tips, insight, or feedback on this approach, or how this might be done?

The third site contains a plethora of ‘subscriber’ users (plus a couple admin users) due to the fact that it’s a WooCommerce store, so this presupposes that I’ll have a handful more of users I’ll need to import next!

Thanks in advance,

0
David Gaskin 4 months 0 Answers 28 views 0

Leave an answer