Create multiple users


Table of Content

Overview Overview

In this article we are going to see how to create multiple users with different user roles for testing the theme or plugin.

I am using WP CLI command wp user create to create the users.

If you don’t have WP CLI setup then read how to install WP CLI?

Okay. So, lets see how use wp user create command.

Top ↑

Syntax Syntax

wp user create <user-login> <user-email>

Here, We need to pass the username & email ID to create a new user. We have some different WP CLI associated arguments to set while creating the new user.

All of these associated arguments are optional.


Read more about wp user create.

Top ↑

Example Example

Lets create the administrator user with username test-administrator and password 12345.

wp user create test-administrator --role=administrator --user_pass=12345

Now, Lets create contributor, editor, author & subscriber users with there associated user roles.

Use blow commands which create all these users.

wp user create test-contributor --role=contributor --user_pass=12345
wp user create test-editor --role=editor --user_pass=12345
wp user create test-author --role=author --user_pass=12345
wp user create test-subscriber --role=subscriber --user_pass=12345

After executing above command you can see something like below:

Create multiple user roles with WP CLI command.
Created multiple user roles with WP CLI command.

Create multiple users with wp user create command.

Leave a Reply