How to Add an Admin User in WordPress using FTP?
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.
Lockdown of the WordPress admin is so Frustrating. So in this article, I’ll let you know how you can create admin user without FTP and MYSQL.

Why Did You May need to Add an Admin User in WordPress Using FTP?

Sometimes it happens when we forgot our admin username, password, and email and in that situation, we’re unable to login to the dashboard.
so there is one method by SQL query through which you can insert admin user but you wouldn’t want to run SQL query.
Sometimes websites got hacked and admin users deleted by hackers and in this situation, you can add admin users quickly by FTP access to restore admin access.

So let me explain how you can do that with the help of FTP.

First of all, you need FTP client through which you can connect to your server and once you got connected you need to go to your active theme’s function file whose path should look like this :/
You can download this file by right-clicking on it.
Once you have downloaded this file just open it and put the below code in the end of the file

function wpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = '';
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' );


After putting the code don’t forget to change the username, password, and email address.
After changing the values save it and upload it to FTP.
Now go back to your website’s admin URL and refresh it and put the username/email and password that you have just changed the file and login. Once you have logged in then go to your function file and remove the added code from the file.

So that’s it for now, Hope you guys like this. We will come up with another blog post soon. If you have any queries or any questions about this code snippets. Contact us for more information and follow us on LinkedIn, Facebook, and Instagram.

Happy Coding Guys