Add Admin User in WordPress using FTP
As a WordPress user, it can be frustrating to forget your login credentials or to be unable to access your website for any reason. Fortunately, there is a way to regain access by add admin user in WordPress using FTP. In this post, we will walk you through the process of adding an admin user using FTP.
Connect to your website using FTP
The first step is to connect to your website using FTP. You can use an FTP client like FileZilla to connect to your website. Enter your website’s FTP credentials and click on the ‘Quickconnect’ button.
Navigate to your website’s root directory
Once you have connected to your website using FTP, navigate to your website’s root directory. This is usually the public_html folder. If you have installed WordPress in a subdirectory, then navigate to that subdirectory instead.
Locate the functions.php file
In the root directory, locate the functions.php file in the wp-content/themes/your-theme/ folder. This file is responsible for loading the functions of your theme. Right-click on the file and select ‘View/Edit’ or ‘Download’.
Add code to the functions.php file
Open the functions.php file in a text editor and add the following code at the end of the file:
function wpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = 'email@domain.com';
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');
Make sure to replace Username, Password, and email@domain.com with your own values.
Save and upload the functions.php file
Save the functions.php file and upload it back to the wp-content/themes/your-theme/ folder on your website using FTP. Overwrite the existing file if prompted.
Log in with the new admin user
Now you can log in to your WordPress dashboard with the new admin user credentials you just created. Once you have logged in, you can change the password and email address for the new admin user to something more secure.
In conclusion, adding an admin user in WordPress using FTP is a simple process that can save you a lot of trouble in case you forget your login credentials or are unable to log in for any reason.
Just follow the steps outlined in this guide and you’ll be able to regain access to your website in no time.