How Do I Retain Old User IDs During WordPress User Imports?
When you import WordPress users, they get a new user ID by default. To retain an old user ID contained in the import data, you must use custom code in combination with our API. However, if the old user ID is already in use in the new system, this approach will not work, and a new ID will be assigned instead.
Steps to Retain Old User IDs During WordPress User Imports
- Go to All Import › Settings and create a PHP function in the Function Editor as per these instructions: Keep Old IDs When Migrating Users or Customers.
- Create a standard WordPress user import by following the first five steps of How to Import WordPress Users from CSV, Excel, or XML.
- Complete the import.
Import WordPress Users from CSV, Excel, and XML
- All user data
- Passwords
- Any theme or plugin
- Any file type / structure
- Custom PHP code
Visual Steps to Retain Old User IDs During WordPress User Imports
Retain Old User IDs During WordPress User Imports — Frequently Asked Questions
If I Can't Retain Old User IDs and I'm Forced to Use New IDs, How Do I Maintain the User Links to Other Old Data (i.e., links that previously used the old user IDs)?
First, you'll need to import the users first so that their new IDs are assigned. Once this is done, maintaining links to other import data depends on the post type of that other data. In some cases, WP All Import has specific features that allow you to match users based on fields other than user IDs, such as names or email addresses. If that's not the case, you will have to write custom code to create a similar match method, retrieve the new user ID, and then populate this new ID in the incoming data.
Can I Retain Old IDs for Other Types of Data?
Yes. In addition to retaining old user IDs, you can also:
- Keep Old IDs When Migrating Products or Posts
- Keep Old IDs When Migrating Categories and Other Taxonomy Terms
- Keep Old IDs When Migrating Comments
Related Docs
Explains how to export WordPress users to CSV, Excel, or XML.
Describes how to migrate WordPress users from one website to another.
Shows how to export WooCommerce customers to CSV, Excel, or XML.
Explains how to import WooCommerce customers.
Describes how to migrate WooCommerce customers from one website to another.
Shows how to execute custom code to modify import user data on the fly.
Oxygen Builder's review of the five best plugins for WordPress user imports.
Oxygen Builder's review WP All Import.