Skip to content Skip to main navigation Skip to footer

4 Easy Ways To Add Admin User in WordPress

Add admin user credentials to the user’s details. In the initial setup for the WordPress site as a user, we would have not had a concern about having the user as a prime user or an Admin user. But later, necessities may lead to the need of changing the regular user settings to an admin user for authorization, security and accessing specific options, and controlling access to all files. And if you are facing this difficulty in changing a regular user to an ‘Admin user’ or a ‘Super Admin user’ then here are different methods through which you can make this same query committed to your website.

Add user as admin in wordpress
WordPress – Dashboard

Create Admin User programmatically in WordPress

Adding this code to the themes functions.php file and enter the username, password, and email address along with your credentials set for the admin login and eventually add user admin capabilities.

 * Create an admin user add programmatically
 add_action('init', 'xyz1234_my_custom_add_user');
 function xyz1234_my_custom_add_user() {
     $username = 'username123';
     //set usename as per preference
     $password = 'pasword123';
     //set password as per preference
     $email = '';
     //set email as per preference
     if (username_exists($username) == null && email_exists($email) == false) {
         // Create the new user
         $user_id = wp_create_user($username, $password, $email);
         // Get current user object
         $user = get_user_by('id', $user_id);
         // Remove role
         // Add role

Pasting this code snippet in the functions.php file will eventually add the user with the $username, $password, and $email as the admin programmatically.

Change User to Admin WordPress (Phpmyadmin)

A stepwise guide to add user admin this process includes:

  1. Access the tool phpMyAdmin and access MySQL database. In phpMyAdmin, edit your database as preferred.
  2. wp_users table: select WordPress database for your site from the list of databases sorted, and click on wp_users table. Once done,  
  3. Insert a new WordPress admin user in the users table and name it accordingly.
  4. The details which are mandatory for creating an admin in the WordPress site includes:  
    • user_login: or username for the admin access
    • user_pass: or password for the admin access
    • user_email: or prime email address
    • user_registered: or date and time of registration.
    • user_status: zero is the value to be set.
  5. Once filled click on “Go” to head over to success acknowledgement page.
  6. Now returning back to the wp_users table, you could find the new user added with the users existed. Note the ID provided.
  7. Now head over to wp_usermeta table to fill away the meta details of the admin user.
  8. Click on Insert >> search for x_usermeta. Inside whih fill out these:
    • user_id: ID of the admin user that you noted in the wp_users table.
    • meta_key: add wp_capabilities as value.
    • meta key value: add a:1:{ s:13:”administrator”; s:1:’1’;} as value.
  9. Click “Go” to complete the user creation. By this you add admin user settings to your prefered user and thus it is a admin user now.

Add admin user WordPress functions (PHP) using FTP

The first and foremost necessity for this is being an FTP client. If you are a new user of FTP, refer to some basic concepts for a better understanding of the upcoming process.

 function wpb_admin_account(){
 $user = 'Username';
 $pass = 'Password';
 $email = '';
 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');
  • Search for theme’s functions.php file and download the file.
  • Open the downloaded file in a code editor or text editor and replace the username, password and email id with your admin account’s values (the values set for the admin account being created).
  • Save the changes and upload the file again in the same location. Once done, try signing in with the credentials just entered in the file with the WordPress log in page. If logged in the process is successfully complete. Once entered via the credentials, delete the changed code piece that you added right now to the file. By this you add admin user settings to your prefered user and thus it is a admin user now.

WordPress Admin Account

Adding a common account is fairly easy to adopt. Always adopting a temporary or expiring user admin account is best preferred for security reasons.

  1. Log in to the WordPress site and reach the dashboard
  2. Click on the users option in the menu bar located in the left side of your dashboard.
  3. Click “Add User” and click on the “Add New” button and fill out the details required and finally set the role of the user as “Administrator”. When done, click on “Add New User”.
  4. Now, use the User Id and Password to login and you will login to the site as an administrator. By this you add admin user settings to your prefered user and thus it is a admin user now.

WordPress Create Super Admin in Database – Additional Addon.

Adding a Super Admin user is possible with adding a script to your functions.php, phpMyAdmin, or via the network to add admin user.

Using network admin for creating Super Admin:

In the settings, below the username option, you can find the super admin option where it will ask for “Grant this user super admin privileges for the network”. Tick the checkbox and refresh the page. Now your user is a Super Admin User.

Using phpMyAdmin for creating Super Admin:


 Add this code snippet and refresh to see the changes.


  • a:2 refers to the no. of entries entered admin user. You will change this no. once an admin is entered as a new entry.
  • i:1 and s:5 is simply the copied code from the previous entries and refers to the no. of characters.
  • Andy refers to the sample username entered. You should enter your username which should be changed to Super Admin.


  • Open the portal and select ‘environment name and click through phpMyAdmin that is located at the top of the site.
  • Select your database by clicking on any of the databases. wp_environment is the primary database for the environment. Then is this snapshot_environment which is the legacy staging database for the environment. Choose the right database that suits you.
  • Select wp_users and customize the database prefix or youprefix_users.
  • Insert a user and add the login details as given in the previous sections.
  • Additionally, you will be requested to add the display_name, user_status, and user_nicename apart from user_email, user_name and user_pass.
  • Now click on “Go” and Go again in the query page display, once done a green tick mark will appear to confirm your user’s activation as Super Admin. By this you add user super admin settings to your prefered user and thus it is a super admin user now.

For more WordPress site customization queries do check our site and spot out all the solutions you will need:

For similar solutions and queries, also check with wpbeginner

Was This Article Helpful?


There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *