0

I have to move a WP site into a multisite network as a subsite. This is the current structure:

  example.com
  -> example.com/site2
  -> example.com/site3

Currently, the site that I want to move has almost 2000 posts by different users. I succeeded in moving it (into site3), but I had a problem with assigning users their old posts. I went into the database and edited the id's (with a foreign key check), but it's only seemed to cause more problems than solve them.

What other way can I move the posts and have them assigned to their rightful authors?

  • How did you move them? If it's a multisite you don't need to change the IDs if both the source and the target are the same install. Have you considered using a standard import/export so you can specify mappings? – Tom J Nowell Aug 29 '17 at 18:43
  • @TomJNowell I created the users from scratch. By standard import/export, do you mean with the basic WP import/export or by SQL import/export? – wiredfordesign Aug 29 '17 at 18:46
  • the standard importer, with the WXR files, not raw SQL – Tom J Nowell Aug 29 '17 at 18:49
  • @TomJNowell the standard importer was unreliable cause it left behind featured images and I still had to go back into the DB to replace broken links – wiredfordesign Aug 29 '17 at 18:51
  • @TomJNowell You're right. A solution might be to use the two. First import with standard importer, then drop all databases except wp_users and wp_usersmeta. Then import the sql file with the other tables, except wp_users and wp_usersmeta. So far, it's worked for me. – wiredfordesign Aug 29 '17 at 21:58
0

Don't bother with the SQL import, instead use a standard WXR import/export.

The importer will ask you which users map onto which during import, letting you create new users or assign old ones, then update all the authors on import.

For larger imports, use WP CLI for both the import and export. Make sure it chunks the import into files with 250 posts max so that memory doesn't become an issue, and pass it a text file mapping all the old users to new users.

If you can't run WP CLI on your server, pull down the site on to a local dev environment, run WP CLI on your machine locally, then do the same for the import, and transfer the database in full to the new remote location

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.