Reset password for WordPress Blog

How to Reset Passwords on WordPress Blogs

Introduction

I lost the password to a hosted WordPress blog that I manage.  This is intentionally change to hack, for good reason.  But, with some Googling, I found a very useful link on how to reset the password.  All you need is to be the actual website administrator and you can reset passwords on WordPress blogs, too.

Reset Passwords on WordPress Blogs

At http://codex.wordpress.org/Resetting_Your_Password, you learn that you can edit the “functions.php” file in the “/wp-content/themes/current_theme” directory where “current_theme” is the name of the theme that is currently in use for the blog.

Taken directly from the above link,

    1. Login to your site via FTP and download your active theme’s functions.php file.
    2. Edit the file and add this code to it, right at the beginning, after the first <?php:

wp_set_password(‘password’,1);

Put in your own new password for the main admin user. The “1” is the user ID number in the wp_users table.

  1. Upload the modified file back to your site.
  2. After you then are able to login, make sure to go back and remove that code. It will reset your password on every page

So, for example, you can set that note ‘wp_set_password(‘doggy’,1)’ in the functions.php file. Then as you log in with the “Admin” account using that password, the password is reset. Re-edit that file to remove that wp_set_…. piece of code. You can freely log in now to change passwords, etc.

Conclusion

There is another way where you edit the database directly.  It’s actually not too difficult either.

Regardless, hopefully, this never happens to you.  Using a password manager can make this problem obsolete.  But, if you do need help, perhaps this can help.

Leave a Reply