Today, We will talk about, how we can add a new user in WordPress. Adding user in the WordPress means how we can add a new author, Admin, Editor, and contributor to the WordPress. So, that they write, manage and update our website/blog time to time on your behalf.
Sometimes, We have to provide access to our site to the third party for a technical upgrade or if you want to show your WordPress Dashboard area to the Third Person.
Users with low access functions (WordPress role and capabilities) will see fewer options in the WordPress Dashboard whenever they’re logged in. We will talk about this in detail in WordPress User Roles And Capabilities article.
But, Now I will only focus on, how we can add a new author, Editor, contributor, admin in the WordPress. I also cover, How we can change the User Role and delete the User from WordPress whenever we need it.
There is three different way to Add User To WordPress; I will cover each of them one by one.
- Add User To WordPress By Manually
- Add User To WordPress Database via MySQL
- Add User To WordPress By using FTP
Table of Contents
Toggle1. Add User To WordPress By Manually
This is the easiest and best way to add a user to WordPress is Manual. You just have to enter the detail of the user like Username, password, and email, etc.
So Let we do this first.
- Login your WordPress as an Admin and Click on All Users. Here you will see all your existing user (included you).
Note: Whenever you add a new user in the WordPress, you can find him under All User Tab.
- Now click on Add New to add a new user in the WordPress and fill his personal information.
Here is a Summary
- Username (required) – Enter the username of the new user here. This will also be used as the Login name of the new user.
- Email (required) – Enter a valid e-mail address of the new user here. The e-mail address must be unique for each user. If a published post or page is authored by this user, then when approved comments are made to that post or page, a notification e-mail is sent to this e-mail address.
- First Name – Enter the first name of the new user here.
- Last Name – Enter the last name of the new user in this text box.
- Website -: Enter the user’s website name (URL address)
- Password – Enter a password for the new user.
Note: For the security, reason Username and Password should be complicated and not easy to guess. Once the username is set, you can’t change it from the setting.
It is a better idea to chose a Strong Username for WordPress security. But if you already set the week Username then don’t worry you can change it. Read my previous post. How I can “Change WordPress Admin Username.”
After adding his personal information and his website address, Now its time to set the user ROLE on your website.
Note: Never give administrative access to any unknown person until you understand the WordPress role and capabilities. That we are going to cover upcoming Tutorial. But here is a quick summary of WordPress role and capabilities
Summary
- Administrator: nothing is off limits* (see note below)
- Editor: includes access to all articles, pages, comments, categories, tags, and links.
- Writer: may write, upload photographs too, edit, and publish their own articles.
- Contributor: includes no publishing or uploading capability, but can write and edit their own articles until they are published Follower (public sites) /
- Event Manager:
- Mail subscriber:
So, assign the job that you want to assign the User/Team member/Technication and click on Add new user to save the setting.
- Here, I’m adding a user (for testing purpose on my local server) with a different-different user Role.
Now, Let we see;
how it looks when I login as an Author Role.
You can see I have only limited access to the WordPress Dashboard.
- The author has full access to his profile. He can edit and update his personal information but can’t see another author.
So, In this way, you can add a user to WordPress.
Delete and Changing User Roles in WordPress
Any Admin of the website can change the User Role of the user in the WordPress.
- Just Login your site as an Admin and click on All User,
- You will see the list of the user.
One thing here is important to note is that,
If you hover over your own Username, you will not see any delete option for yourself. You can delete another user like Author, Contributor, etc. and administrative too (If you have an administrative level access) but you can delete yourself.
- After Opening All User Tab, Select the user for which you want to change the role.
- Scroll down the page and select the Role from the Dropdown Menu.
- Now click on save
You can also change the Display Name in the WordPress. Just scroll down and find the option Display name publicly as.
Select the user name and update the user Profile.
So, In this way, you can change the User Role of a pre-added or new user.
2. Add User To WordPress Database via MySQL
Is it important to know how to add a user on the website though database? The answer is “yes.” Sometimes we stuck in that kind of situation when we not able to login in our website admin area.
Recently, I get a message from my friend; he was hacked by a hacker. Hacker deletes his user account from the database. This locked them out of their site without any other entry. Then I go to the database and add a new user in his database so that he can login in it again.
So it is important to know how to add a user in WordPress from the database. In this case, you need, your Cpanel access so that you can edit your database.
In this case, you need, your Cpanel access so that you can edit your database and find Database name.
- Login your Cpanel, find PHPMyAdmin and Open it.
Warning: Make user you take the backup of your Database before changing anything in the Database.
If you have more than one Domain in your Cpanel, then you see more than one Database Table in your PHPMyAdmin. You have to figure out which database belongs to which website.
The best way to do this is, check your wp-congig.php file. You can find this file in your File manager under Cpanel.
- Open your CPanel and then click File Manager. In the root your file Manager you will see a wp-config.php file.
Note: This file contains your database prefix, database username, and password, etc. So, don’t share this file with anyone.
- Download this file to your local computer and open it with Notepad or any other software.
You can use the search command to find the database name. Press ctrl+F to open search command in Notepad. Here you can see my database name is “speedupwordpress”.
So in this way, we can find the name of the database in the file manager.
Now, we know the database name. So it’s a time to open PHPMyAdmin file and just click on speedupwordpress to open it.
Note: Wp is my prefix of the site, and a user is the WordPress entry name, Wp could be changed in your database. For example; OEfenf_user or wjdj_wp_user. But WordPress entry remains same.
- Now click on wp-user and open it. Here you will see already added a user in WordPress.
- At the very top of the site, you will see an option called insert, click on it to add a new row in the database.
A new window will be open for the following entries, just fill the detail of the new user.
- ID – Add number (number always greater than the number of user on your site. I’m using 9)
- user_login – insert the username for login.
- user_pass – add a password for this username (Make sure to select MD5 in the functions menu).
- user_nicename – put a nickname or something else that you would like to refer yourself as.
- user_email – add the email you want to associate with this account.
- user_url – this would be the URL to your website.
- user_registered – select the date/time for when this user is registered.
- user_status – set this to 0.
- display_name – put the name you like to display for this user on the site (it can be your user_nicename value as well).
Now, you have to add few more entries.
- This time open wp_usermeta table and click on the Insert again from the top of the page.
- Here you will see two column, just below one and each other.
Fill the following detail,
- unmeta_id – leave this blank (it will be auto-generated)
- user_id – this will be the id of the user you created in the previous step. Remember we picked 9.
- meta_key – this should be wp_capabilities
- meta_value – insert this: a:1:{s:13:”administrator”;s:1:”1″;}
- Insert another column with the following information:
- unmeta_id – leave this blank (it will be auto-generated)
- user_id – this will be the id of the user you created in the previous step. Remember we picked 9.
- meta_key – this should be wp_user_level
- meta_value – 10
Click on GO to save the setting. Now go to your login page and try to login with your new user and password.
Now go to your login page and try to login with your new user and password. I’m sure you can login with new detail.
Note: Once you logged in your site. Just open the user profile and click on save button.
In this way, you can Add User To WordPress Database via MySQL.
Add User To WordPress By using FTP
Sometimes, some hosting service does not provide the direct access to Cpanel. So they provide an FTP account to do this kind of activity.
In this method, We first have to download the function.php file, then add few line of code and again upload it to the site.
- First, connect your FTP account to your server with the give confidential info.
The right side, You will see your Server and left side is your local Computer. You can drag any file from left to right to upload directly to your server.
Note: Your function.php file is stored in the theme folder and your theme folder stored in the Wp-content folder, and your wp-content folder is in your root folder (website name)
Track this path to find the function.php file;
/yoursite.com/wp-content/themes/your-current-theme/functions.php
Just right click on it and download the file to your local computer.
Now it’s time to add the code in the function file.
- Open the file and add the following code at the bottom of the function.php file.
Note: Here I’m using Atom to edit code, but you can use any software or Notepad.
function wpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = '[email protected]';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
} }
add_action('init','wpb_admin_account');
After adding code, save it and upload the file to the server with the help of FTP account in the same place.
- Now, you can login your site as an admin with username as “Username” and password as “Password.”
Warning: After adding code, login your site and add New User with the admin level access. Now delete the code from the function file as soon as possible for the Security reason.
Everything is done,
I hope this article helped you learn how to Add User To WordPress and how to change user Role too. Thanks for reading
Remember to share this post with anyone who might benefit from this information, including your Facebook friends, Twitter followers and members of your Google+ group! And also Support Us By Liking Our Facebook, Twitter, and Google+ Page.
If you have any suggestion or problem about how to add a user to WordPress, then please feel free to comment below.