Create WordPress Admin User Through FTP

Create WordPress Admin User Through FTP

Hello friends, Today in this article we will read about how we create WordPress admin users through FTP. FTP will help us to create a WordPress Admin User when we don’t have any other access. You can explore our FTP tutorial if FTP(File Transfer Protocol) is a new thing to you.

A few days back one of my friends asked me if it is possible to create an admin user without Database or WordPress Admin access. I said Yes, of course, it is possible. Actually, sometimes users forget their username/password or some security plugins locked users.

We can also add an Admin user in WordPress through MySQL but today we will learn how to create an admin user through FTP. So let’s start.

Creating Admin User in WordPress Through FTP

STEP #1  First of all you have to connect your FTP client, see this tutorial, on how to connect it.

STEP #2  Once you are connected to FTP, download the website activated theme functions.php file. It would look like this /

download functions.php file

STEP #3  Now open your functions.php file using any editor you are familiar like as simple Notepad, or Notepad++. Now what you have to do is, copy the below code and paste it into your file at the bottom. This code helps you to create a WordPress Admin User.

function add_admin_account(){
    $user = 'your username';
    $pass = 'your password';
    $email = 'your email address';
        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' );

Note #1: This is just a code, so please make sure to replace your Username, Password, and Email with your own.

STEP #4  Once you added the code, please upload it back to your website theme folder using FTP.

STEP #5  Once uploaded, visit your website login page /wp-admin or /wp-login.php or any custom login page you have and sign in with the user account you have created.

Note #2:  Once you logged in, edit the functions.php file and remove the code you have added.  Deleting the code will not make any effect on your account.

Hope this article helped you learn how to create WordPress admin users through FTP. Please share your thoughts in below comment box.

If you liked this article, please subscribe to our YouTube Channel for more tutorials. Keep learning and sharing.



Please share your thought