2 Ways to Reset Your WordPress Password

Last modified: January 13, 2020

Cloudways

This shouldn’t happen to you very much (or at all), but sometimes we forget to write our password down / get hacked / change our password and forget it, etc. etc. Usually we could just click the “Forgot password” link on the login page and be done in 2 minutes. However, what if your server is having an issue sending emails? Or what if you are developing locally and can’t use the email functionality? Well, luckily for you there are 2 very easy fixes to this annoying issue.

Show More

* This button will show the rest of the post and open up an offer from a vendor

Reset your Password in phpMyAdmin

  1. Open your database in phpMyAdmin
  2. Go to the wp_users table
  3. Click edit
  4. Choose MD5 in the function column
    md5
  5. Switch the current md5 password into something simple (can be changed in the admin)
    password
  6. Go to your login page and login with the new password
  7. Done!

Add a New User Through functions.php

This option doesn’t even require meddling with the database. Head over to functions.php and paste the following at the end of it.

function add_admin_account(){
  $user = 'newadmin';
  $pass = '123456';
  $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','add_admin_account');
  • Switch the username & password with relevant ones
  • Head over to your login page and login with your new username
  • Remove the function when you are done
  • Done!

Final Thoughts

As you can see, it’s very easy to login to your site even after loosing your password. Just follow one of the options above and you will be fine.

Recap:
Save 4 Later
Email liked links to yourself