So I have followed the tutorial below to reset my own passwords when I get forget my password for WordPress Admin login


but it does not seem to work for this other site I am working on. I am not sure why. I have heard colleagues talk about the PHP Portable password hashing framework. Could someone explain to me, if this indeed is the issue, do I simply use a tool like this one:


because I have tried it and it has not worked either and I am out of ammo for a solutions. Please help.

Does anybody know if any of these plugins or this error message could be the problem:

[email protected] [~/public_html]# wp plugin list
Notice: Undefined index: HTTP_HOST in /home/medthursday/public_html/wp-content/plugins/simple-301-redirects/wp-simple-301-redirects.php on line 271
| name                                       | status   | update    | version    |
| advanced-custom-fields-pro                 | active   | available | 5.5.0      |
| akismet                                    | inactive | available | 3.2        |
| custom-post-type-ui                        | active   | available | 1.4.3      |
| hc-custom-wp-admin-url                     | active   | none      | 1.3.2      |
| hello                                      | inactive | none      | 1.6        |
| wd-instagram-feed                          | active   | available | 1.1.16     |
| post-types-order                           | active   | available | 1.9        |
| regenerate-thumbnails                      | active   | none      | 2.2.6      |
| remove-query-strings-from-static-resources | active   | available | 1.3.1      |
| simple-301-redirects                       | active   | none      | 1.07       |
| sucuri-scanner                             | active   | none      | 1.8.3      |
| sumome                                     | active   | available | 1.22       |
| theme-check                                | inactive | none      | 20160523.1 |
| updraftplus                                | active   | available | 1.12.29    |
| user-role-editor                           | active   | available | 4.31       |
| wordfence                                  | active   | available | 6.2.6      |
| wordpress-importer                         | active   | none      | 0.6.3      |
| wp-pagenavi                                | active   | none      | 2.91       |
| wordpress-seo                              | active   | available | 3.8        |
  • 1
    what do you mean it's not working?
    – rudtek
    Apr 4, 2017 at 22:15
  • Meaning, after I update wp_user user with a new password, I refresh example.com/wp-admin, try to login and nothing, I still cannot login. I have done this a million times with my own personal website.
    – Daniel
    Apr 4, 2017 at 22:16
  • do you get an error? did you check error log? Are you using example.com/wp-login.php?action=lostpassword ? if so, do you get the email?
    – rudtek
    Apr 4, 2017 at 22:18
  • the error I get on the front end is that the username and or password is incorrect. Which error logs do I check in the server? Emailing myself a reset tells me that my email does not exist, which does, its in phpMyAdmin, but then again, so is my username and password.
    – Daniel
    Apr 4, 2017 at 22:21
  • you may not be getting an error in that case. are you able to login to the site with a differnent user? have you ever been able?
    – rudtek
    Apr 4, 2017 at 22:32

3 Answers 3


Maybe this is not the answer you look for but giving one of below a try could maybe help you out?!

Ofcourse you have FTP or SSL access.
If you don't have one of them, don't bother to read any further!

The good old make a backup from in this case functions.php before you start adding/editing is wishdom and could be important.

Start by activating debug in wp-config.php to see(hopefully) possible errors when some seems to bother WordPress.

Option 1:
Add in functions.php the following code snippet when your admin user has ID number 1(ONE):

 * Read more {@link https://codex.wordpress.org/Function_Reference/wp_set_password}
$user_id = 1;
$password = 'newpasswd';
wp_set_password( $password, $user_id );

Please note: This code should be deleted after ONE page load, otherwise the password will be reset on every subsequent load, sending the user back to the login screen each time.
Change both to your preference! When the Administrator is not having user_id 1 and you have no idea which user_id number it should be, please forget this option. (no need to tryout!)

When you have add the snippet try to login your site. (be sure browser cache is empty)
Try now to login with your admin name and your new created password.
Successful? If yes, delete the snippet from functions.php and all should be fine now.
Not successful? Delete the snippet and try option 2.

Option 2:
Add in functions.php the following function, which will*(should)* create a new administrator user for you. Change $username \ $email \ $password to your preference. (a correct working email address would be logical)

 * Create a new user with admin caps
 * Read more {@link https://codex.wordpress.org/Function_Reference/wp_create_user}
 * @version WP 4.7.3
add_action( 'init', 'wpse262478_add_new_adminuser' );
function wpse262478_add_new_adminuser()
    $username = 'aname'; 
    $email    = '[email protected]';
    $password = 'LZTf$f$FR)Y@xye';
    $user_id  = username_exists( $username );

    if ( !$user_id && email_exists( $email ) == false )
        $user_id = wp_create_user( $username, $password, $email );

        if( !is_wp_error( $user_id ) )
            $user = get_user_by( 'id', $user_id );
            $user->set_role( 'administrator' );
} // end function

(make sure the browser cache is empty, which can always be helpful in these situations)

If you are successful you can login with the new created admin account (if not directly working press F5 on the keyboard to refresh a few times) and can delete the function from your functions.php. If you are not having success you still have to delete the function because this option seems also fruitless.

Hopefully one of the above did help, if so, stop reading and take a deep breath. If not, maybe followng could be helpful.

As you already tried accessing through phpMyAdmin (seen the chat discussion) which was also fruitless, you can still try another option which is not always helping but at least you did a -try and error-.

Option 3:
Rename your plugins folder to something else and retry option 1 or 2.
If successful, login, rename the plugin folder back to plugins. Now you have to enable 1 by 1 each plugin and check if all still is working.
When all seems okay then at least you found a solution but still have no answer about the 'why was it not working' but it would be too far to digg into that issue but at least now you can take some time to find out what it maybe could be.

ps, did you check your functions.php also, maybe there is code which could be the culprit for this dilemma?!

  • Charles, thanks for the suggestions, but none of it worked.
    – Daniel
    Apr 5, 2017 at 3:18
  • guys, I added more detail. Let me know if this serves as a clue.
    – Daniel
    Apr 5, 2017 at 3:57
  • From what I had to do, add_action is necessary for Option 1 as well. So: add_action( 'init', 'wpa5784583_init' ); function wpa5784583_init(){ $user_id = 2; $password = "NEW_PWD"; wp_set_password( $password, $user_id ); }
    – jbobbins
    May 11, 2020 at 16:39

You can change your password through db user table . Go to databases and open user table and find admin and change your password with md5 selection and save the table.

I think you can get help through this link Reset Wordpress Password

  • 2
    Abhishek, this is how we have come to this point, because that way is not working.
    – Daniel
    Apr 5, 2017 at 12:25

you all have been wonderful resources. Now for the answer. It was a plugin called Wordfence that refused to recognize any user I created via wp_users table. If the person with admin privileges did not create my user, there was no way I was going to get in. The users I created it says Existing User No, but when a colleague with admin rights created daniel user, yes Wordfence recognized it as an Existing User. Sooo, I do not know if to be angry that we use that plugin or happy that the plugin works so well.

Top 5 Failed Logins
Username    Login Attempts  Existing User
media_dev   21  No
admin   9   No
earthquake2018  7   No
JosiahSchaefer  7   Yes
daniel  5   Yes
  • Glad to hear you found the culprit as mentioned in option 3 from my answer. It is still strange, did you check if any at all was added to the db (with Wordfence activated) when you tried to make another admin user? I wouldn't be charmed from any plugin which behaves like this one, at least, when this behavior/restriction isn't mentioned anywhere in the docs/faqs. (I am not familiar with those security plugins so I can't tell) If not mentioned anywhere I would inform their devs and ask to mention it everywhere, because it even withholds you from adding/editing the db. Anyway, congrats.
    – Charles
    Apr 5, 2017 at 19:27
  • 2
    So when you said "none of it worked" to @Charles' answer you actually meant, I couldn't be bothered trying option 3;)
    – Jebble
    Apr 6, 2017 at 6:27
  • That is incorrect interpretation. When I said none of it, it included option 3 I went through the gamut of suggestions here and elsewhere. The problem was not the answers, but the fact that I was fighting a plugin called Wordfence and I did not even know it as I did not develop this site.
    – Daniel
    Apr 6, 2017 at 17:27
  • 2
    Daniel. What @JeffreyvonGrumbkow is saying is that this would have been resolved if you have completed Option 3 and disabled your plugins. That would have removed wordfence from the equation.
    – rudtek
    Apr 11, 2017 at 5:17
  • @rudtek, ahh ok, unfortunately at the time I tried deactivating wordfence via wp-cli, but despite the fact I was in the server, wordfence refused to acknowledge what I was doing and I could not get in the wp-admin to disable plugins through there.
    – Daniel
    Apr 11, 2017 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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