How to Reset WordPress Password Through FTP


In case you lost your WordPress admin password, you can use the password reset function to recover it. But what if your hosting’s mail server is not working? There may be some other cases including one when you have installed WordPress on your local system and forgot the password. You can not use the password reset function here. If password recovery is not working, you need to find another way to reset the password. Some people may think about changing the password directly in the database. But WordPress uses salted hash and stores it in the database. So, you cannot directly update the password using PHPMyadmin or any other SQL client.

There is a code snippet that you can use to reset the password. But you need to have access to the functions.php file. If you have FTP access you can use it to change the WordPress password by accessing the file using FTP. You can also open cPanel and then use file manager to access the functions.php file. In this article, I will tell you how you can reset your WordPress password through FTP.

Best Managed WordPress Hosting

WPEngine is the best and most secure managed hosting provider

For connecting to the FTP server of your hosting, you need to first download FileZilla or any other FTP client. You also need to create an FTP account with permission to access your WordPress code files.

Reset WordPress Password Through FTP

Follow these simple steps:

Step 1: Navigate to the directory \wp-content\themes\ directory. This directory contains the WordPress theme.

Step 2: Now open the folder of the theme your WordPress website is currently using.

Step 3: Open functions.php in a file editor and this line at the top of the file:

<?php wp_set_password('password',1); ?>

Here 1 is the id of the admin (OR any other that you mentioned during WordPress installation) user.

Step 4: Save the changes.

Step 5: Now Open your WordPress blog in the browser and navigate to the login page. Now you can log in using the password “password”. It will simply redirect the page without opening the WordPress dashboard.

Step 6: Now edit the functions.php again and remove the line you have just added.

Step 6: Now you can log in again using the password “password”. After the successful login, change the password from the WordPress dashboard. Try to have a secure password that contains characters, numbers, and a special symbol.

Final Words

Now you know how to reset your WordPress admin password without using the native password reset function. If you have access to WordPress files using FTP or Cpanel, you can reset the WordPress password using the mentioned way.

In case you have any problems, you can comment below.


Deepanker Verma is an experienced WordPress developer who has been working on WordPress for more than 12 years. On TheWPGuides, he writes about WordPress, WordPress development, and WordPress plugins.

Similar Articles


Leave a comment

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

© 2022 The WP Guides Developed By Deepanker