Hey guys! I’m back with another blog post. Today I’m going to share another story from my experience. I hope you’ll enjoy it. I had a new work where my client gave me access to his cPanel but didn’t give me WordPress administrator access. But I need access to WordPress to do the work. So with my client’s permission, I added myself as WordPress administrator. How have I done that? Let’s jump into it!
Myself Hussain Abdullah Tofa, known as AbdullahTofa everywhere! I’m a professional freelancer. I work as a virtual assistant at Growthworx Marketing Solutions. Also, I was the SEO optimizer of Family Braces, Georgia, USA.
How to Create an Admin User with FTP/cPanel for WordPress?
To create an admin user with FTP/cPanel for wordPress you have to follow the steps below:
1. Log in to your FTP/cPanel:
Login to the website’s hosting / cPanel directly. The cPanel should come up here yousite.com/cpanel. If it doesn’t appear, then you can directly login to your hosting provider’s site and then login to your cPanel.

2. Go To File Manager:
There is a folder in everyones hosting. All sites have this. This is know as “File Manager”. I’m showing you this in the image below:

Below the 2nd dark line, you all are seeing the File Manager. Click on it.
3. Select the Folder Contain Your Website:
After clicking file manager, you will see a page like below. From that you have to double click on the folder that belongs to your website. For example, in this case I’m going to select my own website folder which is named as “abdullahtofa.com”.

4. Open Wp-Content Folder:
When you are done with step 3, you will see a new page like below. From that page, open the wp-content folder. You have to double click to open the folder.

5. Open Themes Folder:
After opening the Wp-admin folder, you’ll see Themes under Plugins folder. Double click to open it.

6. Select The Theme Folder of Your Website:
Now select your website’s theme folder. Again you have double click it. In case you have more than 1 theme, and if you don’t know which theme you are using, go to yourwebsite.com/wp-admin/themes.php and check which theme you are using like this:

In this case, I’m using AutoRepair theme. So I will double click autorepair folder twice.

7. Locate function.php File:
We are almost at the ending. You have find the function.php file from the list of files under your theme. Check it below:

Note: In this step, you can keep a back up of this function.php file, in case you mess up with something, you can use the backup file again while Create an Admin User with FTP/cPanel for WordPress. Just Simply click once on the function.php file and at the top, you will see a download option. Download it and keep it somewhere safe.
8. Edit function.php File:
Right click on function.php file and then click edit. Leave everything else as it is in the pop-up window. Just click edit again.

9. Time To Add Some Code:
Go to the last line of the codes you are seeing now.

And now add the same code as I am giving below: (just copy paste it)
function create_admin_account(){ $username= 'your-user-name'; $password= 'your-password'; $email= 'your-mail@domain.com'; if( !username_exists( $username) && !email_exists( $email) ) { $user_id= wp_create_user( $username, $password, $email); $user= newWP_User( $user_id); $user->set_role( 'administrator');} }add_action('init','create_admin_account');
In this code, just add your desired user name instead of your-user-name and add your password instead of your-password. And then click Save.

In this example, I added xyzabd as a new user and 12@34ggghhh as a password. So now with this password and username, I can log in.
Thanks for reading. I hope it helped you. Let me know in comment section.