Many newbie blogger’s face several issues and one of the most common issue is Admin account is locked in wordpress. There might be several reasons due to which admin account is locked. In our previous article we had explained you how to add administrator user in WordPress using MySQL. In this article we will explain how to add administrator user in WordPress using FTP.
Why you need Administrator User Account in WordPress using FTP?
You had faced several issues while login on Admin Area in WordPress like forgot email id, username or may be password. In that case you might not be able to login on your wordpress website. If might be possible that your admin account in hacked or website is hacked and admin user account is deleted due to which you are unable to login in website.
In those cases you can add Administrator user in WordPress Database using MySQL or you can add Administrator user in WordPress using FTP. In these ways you can restore admin access in wordpress website.
Now let’s see how you can add administrator user in wordpress using FTP.
Adding Administrator user in WordPress using FTP
Very first of all you will need FTP Client.
Now connect to your wordpress website using FTP client and find functions.php file. You can find functions.php file in following location
/yourwebsite.com/wp-content/themes/your-current-theme/functions.php
Now download the functions.php file in your local desktop or laptop by right click or click on download button.
Now open functions.php file in any text editor software like Notepad or Wordpad or Textpad. Now add below mention code at the bottom of the page.
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’ );
} }
add_action(‘init’,’wpb_admin_account’);
Now replace the ‘Username’,’Email’ and ‘Password’ with your own credentials. Now save the file and upload it to the same location.
Now try to login on your wordpress website with updated credentials. After login in wordpress website go to editor and open functions.php. Now delete the code mentioned above from functions.php. Deleting the code will not delete the user you had added and you can always add editors and authors to your wordpress website.
Hope we had explained you well how to add administrator user in wordpress using FTP. You can share this article with your friends and family members or you can also subscribe to our newsletter for latest update. You can join us on Twitter, Facebook and Google+