Locked out of WordPress admin?

Have you been locked out of your WordPress admin page? These things do happen and it is something that is what happened to me a few weeks ago. There are various way to get around this, such as recover password but in this instance, it was not working for me as I was not getting the emails with the reset link. I had just started moving my sites across to Siteground when this issue occurred. One of the reasons I was moving across to Siteground is that they have WP-CLI and I had read an interesting article by Tim Nash called Running WordPress without any admin users, a dystopian future? I have been around IT for many years and started working on mainframes, ICL 2966 VME to be exact, and it was before PC’s were even invented. So I have been around since the very first PC’s were made and have been brought up on the command line and I love it. Don’t get me wrong I do like icons and all the new stuff but when I have an opportunity to use the command line I do.

Anyway, I digress somewhat from the point at hand. I was getting frustrated at being locked out of my site and then I remembered Tim Nash’s article about running a site without an admin account. As I had SSH access to my site I was able to access it using a terminal window and run the following commands:

wp user list (This command gives a list of users and their corresponding ID number )

wp user update 1 --user_pass=newpassword (replace 1 with id number of the user you want to change and newpassword with your new password)

That is it in a nutshell and a quick way of getting back into my admin account. You, of course, could use this to change any users password and not just the WordPress admin account

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Malcare WordPress Security