How to Add an Admin User in WordPress using FTP: [Complete Guide]

How to Add an Admin User in WordPress using FTP: [Complete Guide]

Do you want to know How to add Admin User in WordPress using FTP? Keep reading this guide, In this today’s post, we are going to show you how can you add an Admin User.

Why may you need to Add an Admin User in WordPress Using FTP?

Sometimes you can forget your email address or username on the website and cannot login in the admin area.

One way of doing this is by adding an admin user in WordPress database by using MySQL. But you may not be able to connect to phpMyAdmin or don’t want to run the MySQL query directly.

Some users can hack their site and admin account can be deleted. In that type of case, adding an admin user by using FTP can quickly restore your access to the WordPress admin area.

Read Also: How to hide unnecessary Items from WordPress Admin?

Now let’s take a look at:

How can easily add an admin user in WordPress using FTP

Adding an Admin User in WordPress Using FTP

  • The very first thing you will need is an FTP client.
  • After connected to your WordPress site, you have to find the functions.php file of your WordPress theme. It will be at a location like this:
  • Right-click on the functions.php file and then choose download. Your FTP client will download the functions.php file on your computer.

Admin User in WordPress using FTP

  • Open a file that is downloaded to your computer by using a plain text editor like Notepad. Now you have to add this code to the bottom of the file.
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’ );
} }
  • Be sure to change your Username, Password, and [email protected] with your own values.
  • After this, save the file and then upload it back to your site by using the FTP client.
  • Now you can go to the login area of your WordPress site and you can sign in with the user account you just added.
  • Once you logged into your WordPress website, then please edit the functions.php file and delete the code that you added.
  • By deleting the code will not remove the user that you added, and you can always add new users and authors to your WordPress site.


Here, we have discussed a way to Add an Admin User in WordPress using FTP? Often, we concluded Why you may need to Add an Admin User.

We hope this blog helped you to add this. If you have any hurdle with adding this, let me know in the comments section.

If you liked this post, please share it with your peers.

We have a team of skilled experts who will help you to resolve your issue related to Install WordPress Theme, dial our Toll-Free number + 1 888 614 0555.

Recommended Blogs:

Leave a Reply