WarpConduit Computing

  • Quick Tips
  • Web Development
  • WordPress Plugins
  • Home
  • Passphrase Generator
  • Password Generator
  • About
  • Contact

How to Reset your Lost or Forgotten WordPress Admin Login Password with wp_set_password

April 17, 2012 by Josh Hartman

Lost PasswordLet me guess…you’ve lost your WordPress admin password, you have no other admins to recover it, and you don’t have access to the admin email account either? Well I hope that you haven’t gotten yourself stuck in that sorry situation, but in case you have go ahead and do this:

Open your site through FTP or cPanel File Manager and add this line just inside the closing ?> of your site’s wp-login.php file (found in the root of your installation):

wp_set_password('foobar',1);

Now, open up a browser go to your WordPress site’s login page (/wp-login.php or /wp-admin) and login using your new password (foobar in this case).

At this point you need to remove the wp_set_password line from wp-login.php and then you’re done. You can now change your password from within the WordPress admin.

The first parameter is the new password you would like to set, and the second parameter is the WordPress user ID. If you need to lookup your user ID connect to your WordPress database using phpMyAdmin or another SQL client and look in the wp_users table.

I’m not sure why the Internet is full of pages suggesting running SQL commands, that hasn’t worked for a while since the passwords are not stored using the MD5 algorithm anymore. Even the WordPress Codex has outdated methods, although it does include the method I have shown you.

Happy log-ins WordPress travelers!

Filed Under: Web Development Tagged With: admin, login, lost, password, reset, wordpress, wp_set_password

Comments

  1. Prasad says

    September 8, 2012 at 3:04 AM

    Hi , I have Found One more way to recover your password.
    http://www.wordpressguide.in/recovering-a-lost-wordpress-admin-password.html

  2. Reset password says

    August 20, 2014 at 3:33 AM

    Awesome! Have been using WordPress for 3+ years, didn’t know about wp_set_password. Shame on me.. But thanks to you, know i now 😉

Connect

  • Facebook
  • GitHub
  • RSS
  • Twitter
  • YouTube

Recent Posts

  • How to Permanently Remove the “Learn about this picture” Spotlight Wallpaper Icon From Your Windows Desktop
  • How to Quickly Test a Fax Machine
  • Extremely Useful Applications for Web Development and IT Tasks

Tags

automatic benchmark bigint class composer css embed escape event font function gzip helper htaccess html htmlspecialchars image increment javascript jquery list magento media mysql number observer opencart order output photo php profiling random redirect rijndael software text type ubuntu url windows windows 7 wordpress xampp xss

Blogroll

  • CodeIgniter
  • Fusion Forward
  • jQuery
  • Nettuts+
  • Smashing Magazine

© 2025 WarpConduit Computing. All Rights Reserved.