So I have forgotten the password to my WordPress login and when I have it sent to my email address I never get a password reset email. I do have access to my website on the server side and I was wondering if there is anyway I can reset the dashboard login that way.

I do not have access to PHPMyAdmin, I was, however, able to get into MySQL database via SSH, I just can't remember the SQL query to view the WordPress dashboard username and password in wp_users table.

So this is how I added to functions.php:

 * Bootstrap to WordPress functions and definitions.
 * @link https://codex.wordpress.org/Functions_File_Explained
 * @package Bootstrap to WordPress
wp_set_password('new_password', 1);

if ( ! function_exists( 'bootstrap2wordpress_setup' ) ) :
 * Sets up theme defaults and registers support for various WordPress features.
 * Note that this function is hooked into the after_setup_theme hook, which
 * runs before the init hook. The init hook is too late for some features, such
 * as indicating support for post thumbnails.
  • @Fayaz, I do not have access to PHPMyAdmin as I do not even remember the username and password of the database. It's been a long time since I have tried going into this website via backend. – Daniel Feb 4 '17 at 2:47
  • Great, please edit your question and add that info. I'll respond accordingly. – Fayaz Feb 4 '17 at 2:51

Since you can access the files with FTP or SSH, go to your WordPress theme directory and:

  1. Go to the active theme

  2. Open functions.php file.

  3. Add the CODE below after <?php opening tag & upload the file:

    wp_set_password( 'new_password', 1 );

  4. Now go to admin login page, typically your-site.com/wp-admin/

  5. Log in with admin user (typically admin) and the temporary password new_password, as set in the CODE above.

  6. Once you try to log in, the CODE above will simply reset your password and redirect to wp-login.php without actually going to admin panel.

  7. At this point, edit functions.php again and remove the above CODE.

  8. Now you will be able to log in to admin panel with new_password (or whatever password you've set in the CODE above).

  9. Change your password from the admin panel (to something stronger) as an added security measure.

  • So I have tried admin and one other username I believe to be correct and it is not working for me. – Daniel Feb 4 '17 at 3:10
  • Are there multiple themes? Is it possible you are editing functions.php from the wrong theme? – Fayaz Feb 4 '17 at 3:12
  • No multiple theme, I confirmed the username by displaying wp_users table. – Daniel Feb 4 '17 at 3:14
  • Yeah, I just saw you updated to have access to mysql with SSH. Updating post based on this new info. – Fayaz Feb 4 '17 at 3:15
  • 1
    Greetings Fayaz, the first time you helped me with this, I think I misunderstood the instructions. I used your instructions for a different situation and it worked. Come to think of it, your solution is awesome. – Daniel Feb 7 '17 at 1:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.