If you lost your WordPress administrator password, or you cannot login to the WordPress dashboard and you do not have access to the WordPress MySQL database, or the password reset functionality is not working, it is still possible to change your password through FTP. In this ten step easy to follow guide we will explain how to change the WordPress administrator password using FTP to be able to access the WordPress dashboard again. If you have access to the phpMyAdmin interface, you can read our WordPress tutorial How to reset a WordPress password using phpMyAdmin in 3 easy steps.
Procedure to reset password WordPress password using FTP
- Using an FTP client connect to your WordPress website.
- Navigate to the directory of the WordPress theme which is currently enabled on your blog or website. WordPress themes can be found in \wp-config\themes\ directory.
- Download the file functions.php of your WordPress theme.
- Add the below line of code after the first <?php line. The number 1 at the end of the line of code is the user ID of the WordPress user you would like to reset the password for. If you are using the default administrator account you created when installing WordPress, the user ID is always 1.
- Save the changes and upload back the files function.php.
- Once uploaded, navigate to your WordPress dashboard login page, typically http://www.yourwebsite.com/wp-admin.
- Login to WordPress using the default administrator account name (typically admin) using the password password.
- Once you submit the credentials (try to login) the login page will simply reload without redirecting you to the WordPress dashboard. This means you have just reset the WordPress administrator password to password. Do not try to login again for now. Each time you try to login, you will reset the WordPress administrator account password.
- Before trying to login again, using the FTP client download the modified functions.php file from the themes directory.
- Remove the line you have added before, save the changes and upload back the file.
Now you can login to the WordPress dashboard with your administrator account using the password password.
WP White Security Tip: Once you manage to login, change the WordPress administrator password to a more secure password. A secure password should consist of at least 8 characters and should not be a dictionary word.
Also, if you want to learn more about WordPress security, read our definitive guide on WordPress security & hardening.