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
Follow WPBeginner on YouTube
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. nikhil says:

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

  2. 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


  3. WPBeginner Staff says:

    Please follow these instructions.

  4. 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.

  5. 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.

  6. 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.

  7. 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?

  8. 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

  9. 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?

  10. 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.

  11. 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

  12. 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.

  13. 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.

  14. 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!

  15. 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?

  16. 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.

  17. 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.

  18. 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.

  19. indrajith says:

    the thumbnail is so funny.. LOL

  20. 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.