Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

What To Do When You Are Locked Out of WordPress Admin (wp-admin)

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
What To Do When You Are Locked Out of WordPress Admin (wp-admin)

This past weekend, we had a user who was locked out of WordPress Admin panel of their site. While we had written numerous articles covering each specific issue, we realized that we should combine all of them at one place to make it easier for others. In this article, we will show you what to do when you are locked out of WordPress Admin (wp-admin), so you can regain access to your site.

There are few reasons why you could be locked out of WordPress admin, so let’s take a look at each of them one by one. Hopefully through this process of elimination, you will be able to figure out the solution for your problem.

Error Establishing Database Connection

Are you seeing this error on your entire site? The reason why you get this error is because WordPress is unable to establish a database connection. This could happen for various reasons. It could happen if your database got corrupted for some reason. It could happen if your web hosting server is having some issues. If this is your issue, then please refer to our guide on how to fix the error establishing database connection in WordPress.

White Screen of Death

Are you seeing a white screen on your WordPress admin? This issue is often referred to as the WordPress white screen of death. It usually happen because you exhausted the memory limit. It could be caused by a poorly coded plugin or theme. It could also be caused by unreliable web hosting. If you are seeing this error, then please refer to our guide on how to Fix the WordPress white screen of death.

Incorrect Password Issue

Sometimes, even when you are typing the correct username and password combination, you won’t be able to login. When you try to reset your password, you never receive the email. This can happen if you were a victim of a hack. We would recommend that you reset your WordPress password from phpMyAdmin.

This method can be a bit overwhelming for new users, but this is your best bet.

Lost Admin Privileges

Sometimes, you may be able to login to your WordPress admin, but you don’t see any of the admin functionality. For example, no plugins, no themes etc. This could happen if your user permissions were modified. Often this happen due to a hack. Hackers would infect your site, and then delete your admin privileges. In this case, you should add an admin user to the WordPress database via MySQL (phpMyAdmin).

PHP Errors (i.e Syntax error, unexpected function etc)

These PHP errors usually happen when you are pasting the code from a website. Often beginners use the built-in WordPress editor from their dashboard. While that feature is pretty handy, but if you don’t know what you are doing, then it can be a disaster. If you pasted a code from a website which locked you out of your WordPress admin, then the first thing you need to do is take a deep breath. Now the only way to fix this issue is using a FTP program (How to use FTP). Once you have installed the FTP program, login to your site. Go to the theme file that you modified. Most likely it was the functions.php file. Now get rid of the code that you added in there. Re-upload the file, and you should be good to go.

Before you go on the site and comment “this code broke my website”, please refer to our beginner’s guide to pasting snippets from the web into WordPress. This is just to prevent you from looking like a fool on the web. Often its hard to admit that the mistake might be yours, so make sure of that first before you point the finger at someone else.

Hopefully after going through all of these possible scenario’s, you have already fixed your site. If one of these solutions helped fix your issue, then please let us know in the comments. If you have a solution that is not mentioned in this article, then please share it in the comments as well.

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Brandi says:

    I have a problem outside of these options and I’m so clueless on the subject that I don’t even know which way to direct myself. My brother hosted the non-profit website that I update. He has since burned personal bridges and it appears professional, as well, as I can’t access our site. I don’t know if he just stopped paying the wordpress fees, but I have no access. When I go to the actual website, my last update a few months ago is still there. Is there any way to access this wordpress account and establish on my own or do I need to create an whole new website?

    • WPBeginner Support says:

      Do you receive an email notification when a user leaves comment? If you do then you can receive password reset information on that email address.

  2. Arpit Jain says:

    my website that is has got hacked and whenever I try to open the wp-login/wp-admin it shows the original page to me.
    Please tell me what should I do to retrieve my website

  3. Wayne says:


    I am completely locked out of my site and cannot access my dashboard. I have multiple user accounts that I use for testing and all of them are locked as well. When I try to log in I get “ERROR: The password you entered for the username spiderwayne is incorrect. Lost your password?”.

    Password Reset
    I tried to reset my password but after I click on the link I get in email to reset it I get a page that says “Your password reset link appears to be invalid. Please request a new link below.”

    I tried to register as a new user and get this message “ERROR: Couldn’t register you… please contact the webmaster !”

    I thought it was the Them-My-Login plugin because this seems to happen after I installed an update from them. So I FTP’d into my site and renamed it. So then when I tried to log in I was back at the default WordPress login page but again I try to log in I get that failed message saying “ERROR: The password you entered for the username spiderwayne is incorrect. Lost your password?”. By the way I also tried logging in using my email address.

    Next I renamed my whole Plugin directory so all the plugins would be disabled.. and I still can’t get in.

    Earlier today I went into phpMyAdmin and I changed the password (md5) on one of my accounts and again it didn’t work.

    The only think I can think of now but really don’t want to do is wipe out my site, get rid of the database and wordpress, reinstall everything and rebuild from a backup from last week and hope I don’t rebuild it with the same problem.

    Anything else you can think of for me to try?


    • WPBeginner Support says:

      Try backing up your themes directory and .htaccess file, and then delete them from your server. Create new themes directory and download fresh copy of a default theme. Upload that theme and then try to access your website.

  4. Carrie says:

    I’ve been scouring the Net for an answer and was hoping someone here can help! I was granted admin access to a friend’s blog and was temporarily locked out because I was trying to enter the wrong password. I was able to get it corrected but now every time I leave a comment on her site, my comment is held in moderation. I have all appropriate permissions; in fact when readers comment, nobody’s comment is set to be held in moderation! I have a suspicion WP has my IP address (and/or username) tagged due to the lockout. Do you know of a way we can fix this? I’ll be writing regularly for her blog and it’s a pain to be at a laptop logged in just to respond to reader comments. Thank you!

    • WPBeginner Support says:

      A number of possibilities here:

      1. There is some security plugin installed that has blacklisted your ip address.
      2. Go to Settings > Discussion scroll down to comment moderation and blacklist boxes and see if your username or ipaddress is listed there.
      3. Akismet is catching your comment as false positive. In that case please contact Akismet support.

  5. Deborah says:

    Hey, so there are days where the backend decides to work and some days not.

    When I type in the URL for the backend, it either lets me through or it redirects me to the front end.

    I don’t know how to fix this!

    -I already cleared all cache and cookies

  6. Sybil says:

    How do I fix this when I login to my page I don’t see the dashboard. It says I need to update to version 4.2. This is on the home page of my website:

  7. Jai Kumar says:

    Hi, I have 2 websites with WordPress. The main website is and the sub website is
    I have lost the control on the main (.com) website. I am trying to login with wpadmin but it’s saying “ERROR: The password you entered for the username h is incorrect. Lost your password?” I tried your method but nothing help. I still have access with website. Could you help me please?

    Thanks in advance.

  8. Yvonne Bertoldo says:

    Hi, i am hacked and i cant access my wp-login. It only shows 500 internal server error. Help pls. Thank you:)

  9. Brian says:

    Got a bit of an odd situation here. I’m doing some marketing consultation for a company who has lost control of its Word Press site. The setup email was registered by an employee who is now disgruntled, and hasn’t been with the company for over a year. The password was known for the past year, but recently forgotten. The reset function is linked to his email address and he’s not responding to anyone’s requests to transition control over to the company owners.

    Is there a way for the owners to prove their ownership and put the admin email in their own hands without having to get the former employee to be involved in any way?

    We have a major marketing program that just went live and the lack of being able to access and update the website is causing serious financial harm to the company.

    Please help!

    Are there any readily available solutions that don’t involve the expense of making this a legal matter?

    • WPBeginner Support says:

      If this is a self hosted WordPress site, then you can access your site’s MySQL database using phpMyAdmin and update the email address under the users table.

  10. Marah B says:

    Hi! I locked myself out of my admin page on my website adding a google ad under Appearance/Editor/Theme Functions. I tried downloading the FTP files that you recommended to help correct this mistake and they won’t open for me (I have a macbook pro).

    Please help :)

    • WPBeginner Support says:

      You can open the file in TextEdit app on your Macbook. You need to edit your themes functions file to undo the changes that caused your site to stop working.

  11. Phil says:

    I’ve changed the WordPress Address URL in the General Settings of my WordPress site thinking tha I was changing the page that showed as the Home page and now I can’t get access to the wp-admin.

    My website is also now showing as text and has no design to it.

    Help! Please! :)

    • WPBeginner Support says:

      Connect to your website using an FTP client. Edit wp-config.php file. Add these two lines, just before the line ‘/* That’s all, stop editing! Happy blogging. */’


      Don’t forget to replace with your own URLs.

      • Sarah says:

        Thanks for that but when you do this and get back in, you cannot ‘reset’ the url in the main admin area?

        Is there a way one can do this please?

        • WPBeginner Support says:

          You can also use functions.php file to update URL. Simply paste this code in your functions.php file:


          Replace with your site url.

  12. Diane La Costa says:

    I am completely locked out of my wordpress. Cannot remember email used or password. I tried all of the emails that I still have access to.

    Is there a number or email to the people at wordpress that I could explain this problem to?
    I cannot find one anywhere! Help!

  13. Tyko says:


    I managed to make a change at the website and/or wordpress adress/URL under settings in admin. Since then as I try to log in I get Error 404 – Page Not Found.

    I can see the rest of the site and the text but the whole design is gone. Its all text.

    Plz guide me so that I can fix this!

  14. nikhil says:

    what should we do if we don’t have ftp access to the website?

  15. Dean Knight says:

    Hi, I moved wordpress from to the main directory using the steps as directed in under the heading “Moving Directories On Your Existing Server” on this page:

    I know want to update wordpress and it wont allow me to do so.

    I am quite happy to make a back up and uninstall / reinstall wordpress and import, but, everytime I have done this in the past I never have images back in the media library and have to manually upload all images.

    Whilst this has been a bit of a drag in the past, the site I know need to do this for has hundreds of images on hundreds of pages.

    What is the best way around this??

    Many thanks


  16. WPBeginner Staff says:

    Please follow these instructions.

  17. ozlem says:

    Hi, I changed my admin password on myphp database exactly as instructed here, generating an md5 level password from the link in this tutorial. But now I cannot even reach my website and I get “error establishing database connection”. What can I do? Something went terribly wrong.

  18. Amit Dadhwal says:

    I have wordpress Multisite. When i am trying to open my one of website its automatically start download & my website is not open even i have full access of my dashboard. How can i fix it.

  19. WPBeginner Staff says:

    First lets get your site back.

    The reason you can’t connect to FTP using Filezilla is probably that you are entering incorrect hostname, username, or password. You can ask your webhosting provider to provide these details to you.

    Alternately you can use File Manager in cPanel. Login to your hosting account and find the File Manager. It is just like FTP only that it works inside your browser. Locate your functions.php file and edit it to remove the code you added earlier.

    As for adding Google Maps, checkout our guide on how to add a Google Map in WordPress.

  20. Doline Myburgh says:

    Hi there.
    Hoping for some help. I’m new to WP, and still finding my feet. Managed to create a rather nice site, and as a final touch decided to ad a google map of some sort into the contact page. All the plug ins that I looked at called for the ‘simple code’ to be incerted. But ofcourse I could not figure out WHERE exactly this should be incerted. So I googled, and it was suggested that the coding should be added into the function php. and the ‘short code’ into the text part of widgets.
    Thus I added the coding at the end of the existing coding in the function php. and when I pressed the button, manage to make my whole site dissapear. I now KNOW NOT TO MESS WITH FUNCTION CODING.
    I know where the error occured, and could easily fix, if I could just get rid of the white screen.
    Then I read that I can try via FTP (Filezilla) and did use filezilla before, so that should be ok.
    I type in my host, username and password, and it runs it’s script, but then ends with red lettering: Critical error. Could not connect to server.
    Now what? Any other suggestions?

  21. WPBeginner Staff says:

    Delete every thing and restore your site from a backup. If you do not have a backup, then it will be quite difficult to troubleshoot the problem. Please take a look at these guides:

    1. How to find a backdoor in a Hacked WordPress Site and Fix it
    2. How to Scan Your WordPress Site for Potentially Malicious Code

  22. Pete says:

    I was messing around with “footer plhgins” and decided that they where troublesome. so I deleted one of them called “sticky footer” and in a sense, thats right, sticky. It messed up my home page and so trying different was to delete an invisible page “behind” the home page was taskfull but I did it however, when I went to put a “new” home page with the same data as the original, it worked but would not return to “home” when clicked from another page. I also noticed that certain words changed to blue and became ad words within my site. This after I added a security plugin the day before. so messing with another plugin to try and remove the malware, was unsuccessful so I brought out the big gun “spybot” to try and clean up the mess. Well, while doing so, I must have removed something and now I have zero access to my site, My wp-admin is not recognized as if it disappeared. what do I do the fix this? or how do I take the site dow and rebuild?

  23. Edwin Lynch says:

    Okay. I was hacked. The whole server was royally hacked. I created a new username with admin permissions, but still couldn’t get in. They had changed all user usernames to admin but demoted the permissions on all. So what I did was 1. delete all security plugins and clean up your .htaccess 2. delete users with your email first. 3. create a new user with admin permission (like you say on this site – the exact tutorial I used). 4. Don’t try and log in with the new user. Use the lost password and the email address (not username). 5. I created a nasty password with the change password email and presto – I was in. Now it’s a matter of re-installing all plugins and clearing out other users.

  24. Steven says:

    Hi. I need help. I have lost all access to my admin page on my website.
    I know I have not changed my password or user name. I have tried following the reset password help on the forums but I can not as of yet find any proof of purchase. Can you please advise me on what else I can do.
    Kind regards

    • WPBeginner Support says:


      We can not understand, why do you need proof of purchase to reset your password? Did you try contacting your webhost? Do you remember the email address associated with your WordPress account or web hosting account?

      • Steven says:

        There was a password reset page that asked for website address and email address and also proof of ownership, that is why in my original message that I could not find proof of purchase as one of the questions was please provide your paypal transaction number.

      • Steven says:

        There was a password reset page that asked for website address and email address and also proof of ownership, that is why in my original message that I could not find proof of purchase as one of the questions was please provide your paypal transaction number.
        My web host? I have UKcheapest would the be the host?

      • Steven says:

        Hi guys, all sorted thanks to my better half. Many thanks for taking the time to reply.
        Kind regards

  25. Nick says:


    I am locked out of my admin. I have loaded the Plug-in: “Maven Member” which restricts access to specific pages. I was testing the registration pages by adding new members as basic subscribers or participants and I never got around to re-setting up my administration access through the plugin. Now when I enter in my username and password, it comes up as “Forbidden”

    I’m thinking that the plug-in overrides the original access (of Course) buy now I have no way of accessing my wordpress admin.

    I tried changing the names of the plugin file and the plugin root folder in the ftp – didn’t have an effect. And now, any attempt to login from the website, even when registering through the new plugin, for limited access, comes up as “forbidden”

    Any ideas. have a lot of work and no ability to do it.

    _ thanks in advance!

    • WPBeginner Support says:

      Try deleting .htaccess file. If this does not solve your issue contact plugin’s support.

  26. Jrew says:

    Getting Error Message: “Cannot modify header information”

    Neither my username or password have been changed and I am locked out of one of my WordPress accounts.

    Anyone recognize this error message and know what to do to get around it?


    • WPBeginner Support says:

      Do you remember the last thing you did before getting this message? Most probably you installed a plugin or changed some code. You would need to deactivate all your plugins or undo the changes you made before getting this error.

  27. Emma says:

    Help I am locked out of my WordPress completely. I tried to set up a password protection for one of my pages within the .htaccess :

    AuthType Basic
    AuthName “restricted area”
    AuthUserFile /home/yourusername/html/protected-dir/.htpasswd
    require valid-user

    When I tried to change it back it kept a asking for a username and password. I was not aware i gave it one. Noe even the public cannot access the website without a username and password. PLEASE HELP!

  28. Winfred Mkochi says:

    I have been locked out because I was trying to change domain name (Site and Home). How can I get access to my Dashboard again?

  29. Lee Williams says:

    I have a WP site and it has been hacked by the “Turk Hack Team” They have changed my password. Changed my email address to access password reset and they have some how deleted my user name too. When I try for recovery using the “recovery account form” it tells me I don’t have an account. Says I must be on not But the last password resets in my emails are .com.
    I haven’t got a clue where to start! don’t even know how to contact WordPress to prove I own my domain and site!!!!
    How are you suppose to get it fixed if you cant make contact?

    • WPBeginner Support says:

      Contact support. They have other ways for you to prove your ownership of the blog. On the other hand if your site was on you would have had much better control on your site and you could have recovered it without relying on a third party.

  30. Sue Ellam says:

    My website is nearly complete but my web designer has gone sick and I have no access to the site to get it finished as he never gave me the passwords. The designer isn’t in communication with me at all as I understand he is seriously ill and I don’t want to have to start again from scratch.

    What do I do please? Surely there must be a way of accessing the website in this kind of scenario. I have proof of ownership and the site has been paid for.

    I would really appreciate your advice.

    Thank you.

    • Editorial Staff says:

      If the website is hosted under a hosting account that you own, then you can request the hosting company to grant you access. If not, then you are pretty out of luck.

  31. Anne says:

    I am desperately looking for help. I am locked out of my WordPress blog, because the Log In does not recognize my password. Every time I am prompted to change it, I do, and it is rejected every time. Every solution to my issue involves being on my blog and I can’t get on. Is there any tech support available.

    • Editorial Staff says:

      Hey Anne, usually your web hosting provider should be able to help you out with this.

      • Anne S. Haskell says:

        Thanks, but as I understand it, it is my web hosting provider that was keeping me out. It took me a couple of days, but I finally figured it out.

  32. indrajith says:

    the thumbnail is so funny.. LOL

  33. Gautam Doddmani says:

    definitely a very helpful guide…btw the featured image is awesome lol :D

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.