How to Reset Your WordPress Admin Password

Locked out of WordPress? Reset the admin password by email, through phpMyAdmin, or with a quick functions.php snippet.

· Updated · 2,985 views

If you cannot log in, there are three reliable ways to reset a WordPress admin password. Start with the email method and move down only if it fails.

Reset by Email

  1. Go to yourdomain.co.ke/wp-login.php.
  2. Click Lost your password?
  3. Enter your username or email and follow the reset link.

This fails only if your site cannot send email or you no longer control the address.

Reset via phpMyAdmin

  1. In cPanel, open phpMyAdmin and select your WordPress database.
  2. Open the wp_users table and click Edit on your user row.
  3. In the user_pass field, type a new password and set the Function column to MD5.
  4. Click Go to save.

WordPress will accept the MD5 value on your next login and upgrade it automatically.

Reset with a Code Snippet

If you have file access but not database access, edit your theme's functions.php and add:

add_action( 'init', function() {
    wp_set_password( 'NewStrongPassword123', 1 );
} );

The number 1 is the user ID. Load any page once, then immediately delete this line so the password is not reset on every request.

After regaining access, change the password from Users > Profile to a fresh value.

Was this article helpful?

Your feedback helps us improve our documentation.

Still Need Help?

Our support team is available 24/7 to assist you.