Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
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 lovers 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 »
  • http://www.wpbeginner.com/ WPBeginner Staff

    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.

  • http://www.wpbeginner.com/ WPBeginner Staff

    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

  • Edwin Lynch

    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.

  • Steven

    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
    Steve

    • http://www.wpbeginner.com/ WPBeginner Support

      Steven,

      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

        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

        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

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

  • Nick

    Help!

    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!

    • http://www.wpbeginner.com/ WPBeginner Support

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

  • Jrew

    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?

    -Jrew

    • http://www.wpbeginner.com/ WPBeginner Support

      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.

  • Emma

    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!

    • http://www.wpbeginner.com/ WPBeginner Support

      Delete .htaccess file.

  • Winfred Mkochi

    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?

    • http://www.wpbeginner.com/ WPBeginner Support

      You can edit site and home url by changing them in wp-config.php file using an FTP client.

      • Winfred Mkochi

        THANKS.

  • Lee Williams

    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 WordPress.org not WordPress.com. 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?

    • http://www.wpbeginner.com/ WPBeginner Support

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

  • Sue Ellam

    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.

    • http://www.wpbeginner.com Editorial Staff

      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.

      • Sue Ellam

        Thank you for your reply. It was very helpful.

  • Anne

    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.

    • http://www.wpbeginner.com Editorial Staff

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

      • Anne S. Haskell

        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.

  • indrajith

    the thumbnail is so funny.. LOL

  • Gautam Doddmani

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