Let 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):
Now, open up a browser go to your WordPress site’s login page (
/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
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!
Hi , I have Found One more way to recover your password.
Reset password says
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 😉