Hey guys! I’m back with another blog post. Today I’m sharing another story from my freelance experience, and I hope you’ll find it useful. Recently, I picked up a new project where my client gave me access to his cPanel but didn’t share his WordPress admin login. The thing is, I needed WordPress access to actually do the work. So with my client’s permission, I added myself as a WordPress administrator directly through cPanel. Here’s how I did it — let’s jump in!

I’m Hussain Abdullah Tofa, known online as AbdullahTofa. I’m a professional freelancer, a team leader at The Electric Viking, and virtual assistant of Proxy1Media.com. I also previously handled SEO for Family Braces in Georgia, USA.

How to Create an Admin User with FTP/cPanel for WordPress

To create a WordPress admin user through FTP or cPanel, follow the steps below:

1. Log in to Your FTP/cPanel

Log in to your website’s hosting or cPanel directly. Most cPanels are accessible at yoursite.com/cpanel. If that doesn’t work, just log in to your hosting provider’s dashboard and access cPanel from there.

cPanel Login Page
cPanel Login Page

2. Open File Manager

Every hosting account comes with a “File Manager” — it’s a standard tool you’ll find in every cPanel. I’ve highlighted it in the image below:

File Manager in Cpanel
File Manager in Cpanel

You’ll find File Manager just below the second dark line. Click on it.

3. Select the Folder Containing Your Website

Once File Manager opens, you’ll see a page like the one below. Double-click the folder that belongs to your website. In my case, I’m selecting my own website folder, named “abdullahtofa.com.”

List of websites in File Manager and Root Folder
List of websites in File Manager and Root Folder

4. Open the wp-content Folder

After step 3, you’ll see a screen like the one below. Find the wp-content folder and double-click to open it.

Files of a Website inside File Manager
Files of a Website inside File Manager

5. Open the Themes Folder

Inside wp-content, you’ll see a folder called themes — usually right after the plugins folder. Double-click to open it.

Themes Folder  in cPanel File Manager
Themes Folder in cPanel File Manager

6. Select Your Active Theme Folder

Now select your website’s active theme folder by double-clicking it. If you have multiple themes installed and aren’t sure which one is active, head over to yourwebsite.com/wp-admin/themes.php to check, like this:

Website's Theme in WordPress
Website’s Theme in WordPress

In this example, I’m using the AutoRepair theme — so I’ll double-click the autorepair folder.

Themes of a Website in File Manager
Themes of a Website in File Manager

7. Locate the functions.php File

We’re almost there. Inside your theme folder, find the functions.php file from the list of files. See the screenshot below:

function.php File Inside a Theme Folder
function.php File Inside a Theme Folder

Important: Before making any changes, take a backup of the functions.php file. If anything breaks during the process, you can restore it from this backup. Just click once on the functions.php file, and you’ll see a download option at the top. Download it and save it somewhere safe.

8. Edit the functions.php File

Right-click on the functions.php file and select Edit. Leave the pop-up settings as they are and click Edit again to open the file.

Edit function.php File
Edit function.php File

9. Add the Code

Scroll down to the very last line of the existing code.

Codes in function.php File

Now add the snippet below (just copy and paste it):

function create_admin_account(){ $username= 'your-user-name'; $password= 'your-password'; $email= '[email protected]'; 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, replace your-user-name with your desired username and your-password with your password. Then click Save.

Adding Code for New WordPress User in function.php File

In this example, I added xyzabd as the new username and 12@34ggghhh as the password. With these credentials, I can now log into WordPress.

Thanks for reading! I hope this guide helped you out. Let me know in the comments.