Creating a new WordPress user can be done in two primary ways: through the WordPress admin dashboard and via the WordPress Command Line Interface (WP-CLI). Here’s a step-by-step guide for both methods:
Method 1: Creating a New User via the WordPress Admin Dashboard
Step 1: Log in to Your WordPress Admin Dashboard
- Navigate to your WordPress login page, typically found at
yourwebsite.com/wp-admin
. - Enter your username and password to log in.
Step 2: Access the Users Section
- Once logged in, you’ll be directed to the WordPress admin dashboard.
- In the left-hand menu, hover over the “Users” tab and click on “Add New.”
Step 3: Fill in the User Details
- Username: Choose a unique username for the new user. This cannot be changed later.
- Email: Enter the user’s email address. This is used for notifications and password resets.
- First Name and Last Name: Optional fields for the user’s first and last names.
- Website: Optional field for the user’s website URL.
- Password: You can set a password manually or use the automatically generated strong password. You can also send the new user an email with a link to set their password.
- Role: Select the role for the new user. Roles define what the user can and cannot do on your site. Common roles include Subscriber, Contributor, Author, Editor, and Administrator.
Step 4: Add the New User
- After filling in the details, click the “Add New User” button at the bottom of the page.
- The new user will now be created and added to your WordPress site. They will receive an email notification if you chose to send the password setup link.
Method 2: Creating a New User via WP-CLI
WP-CLI is a powerful tool that allows you to manage your WordPress site from the command line. Here’s how to create a new user using WP-CLI:
Step 1: Access Your Server via SSH
- Use an SSH client to connect to your server where WordPress is hosted.
- Navigate to the root directory of your WordPress installation using the command line.
Step 2: Use WP-CLI to Create a New User
- The basic command to create a new user is as follows:
wp user create <username> <email> --role=<role> --user_pass=<password>
Replace <username>
, <email>
, <role>
, and <password>
with the appropriate values. For example:
wp user create john_doe john@example.com --role=author --user_pass=securepassword
- Username: The username for the new user.
- Email: The user’s email address.
- Role: The role assigned to the user (e.g., subscriber, contributor, author, editor, administrator).
- Password: The password for the new user. You can omit this to have WP-CLI generate a strong password automatically.
Step 3: Verify the New User
- To ensure the user was created successfully, you can list all users with the following command:
wp user list
This will display a list of all users on your WordPress site, including the newly created user.
Creating a new WordPress user is a straightforward process, whether you choose to use the admin dashboard or WP-CLI. The admin dashboard provides a user-friendly interface, while WP-CLI offers a quick and efficient method for those comfortable with the command line. Choose the method that best suits your needs and workflow.