Import users to WordPress

After searching the net and trying a couple of different plugins for importing users to WordPress I decided that I would have to build one myself. Although some of the plugins worked well they did not meet the requirements that my situation required.

  1. I needed to keep the primary key ID from the previous user database, for that was used to link table data.
  2. I had data in a custom field which I added to the end of the wp_users table that also needed to be imported.

When importing users you need to create entries in both the wp_users table and the wp_usermeta tables.

How importing users was done.

  1. I created a .csv file from the old user db to import into WordPress. users.csv
  2. Created a php script to read the .csv file and insert the data into both the user tables. import.php