It is very easy to manually create users in WordPress, but things are not easy if you want to add a group of users in one go.
WordPress doesn’t have any built-in user import wizard, so if you want to add hundreds or thousands of users, you’re out of luck. You will need to write some code or use a third party plugin.
In this post, I will share a lightweight and easy to use plugin that will allow you to import thousands of users with ease. All you need to do is create CSV files in predefined formats and import them using the plugin. In addition, you can also bulk import the meta values. These are the steps:
Step 1 – Install the plugin
Download and install plugin: “Import and export users and customers”
This is a popular plugin with over 70k installs.
Once you install the plugin, go to Tools->Import users and customers from CSV.
What the plugin offers you:
- Import users and clients from a CSV easily
- And also additional profile information with the user’s metadata (included in the CSV with your custom fields)
- Simply upload the CSV file (one included as an example)
- Auto detect delimiter with support for comma , semicolon ; and bar |
- Export users and clients by choosing delimiters and using some filters
- Create a cron task to perform the import periodically in order to integrate WordPress with an external system
- Interaction with many other plugins like WooCommerce, BuddyPress, Paid Membership Pro, WooCommerce Memebership, WooCommerce Subscriptions and many others
- Import users from the frontend using a shortcode
Step 2. Create a CSV file
Create a csv file with user data like username, email, password, etc.
In addition to importing standard user data, meta values can also be imported. In case the meta values do not exist, the plugin will create them automatically. The plugin automatically generates a password in case the password column is empty.
You can generate a CSV file with all users inside it, using standard spreadsheet software like: Microsoft Excel, LibreOffice Calc, OpenOffice Calc or Gnumeric.
You have to create the file full of information (or take it from another database) and you will only have to choose the CSV UTF-8 file when you “Save As…” the file. As an example, a CSV file is included with the plugin.
Important is that the first two columns must be: Username, Email.
The following columns are fully customizable and you can use whatever you want. All rows must contain the same columns. The user profile will be adapted to the type of data you have selected.
We can add a column called “Password” to manage a string containing user passwords.
If you use the column “ Password”, you must use the text version and if you use the “user_pass” column, you must use the MD5 version.
If you don’t create a column for passwords: Passwords will be generated automatically. If you create a column for passwords: if the cell is empty, the password will not be updated; if the cell has a value, the password will be used.
WordPress default profile data
We will show you the default labels if you want to set data tailored to WordPress default user columns
- user_nicename : A string containing a friendly URL name for the user. The default is the user’s username.
- display_name : A string to display on the site. By default, the username of the user. You’ll probably want to change this, both for appearance and security via *obscurity (ie if you don’t use and remove the default admin user).
- nickname : The user’s nickname, defaults to the username
- first_name : First name of the user.
- last_name : The last name of the user.
Before you import user data, you can configure the import settings:
- Default profile: We recommend choosing the “Subscriber” user role.
- What should the plugin do with empty cells? We recommend leaving the previous values for this metadata.
- Send Email: Depends if you want to report imported users.
- Force users to reset their passwords: It depends if you want to import users with passwords or force users to choose their own passwords.
- Update existing users? We recommend not activating this option, so as not to affect users that already exist on your website.
- Update emails? It depends if you want to update current users’ emails or not.
- Update profiles of existing users? We recommend not activating this option, so as not to affect users that already exist on your website.
- Never update passwords? We recommend not activating this option.
- Delete users that are not present in the CSV? We recommend not activating this option.
- Change the profile of users that are not present in the CSV? We recommend not activating this option.
Example of file for import.
To improve its import, we leave you here an Excel file where you can fill in the user’s name, surname, and email and all the additional data is generated automatically. The Excel file also contains a formula to create a random password. Save the file as CSV UTF-8 and you can import your users directly into WordPress.
In the archive there is a prepared demo user.
And of course, you can add more data you need for your users, before the import.
import the data
When you have the CSV file ready, simply import the file and all users will be imported. The plugin also comes with a sample csv file which is very helpful.
And so, you can import thousands of users directly, without the need to create them manually, or without knowledge of how the database works.