This tutorial is part of our WordPress Management tutorial series. In this tutorial, we show you what to do if you are unable to log into your WordPress Administration area.
To view all of our WordPress troubleshooting tutorials, go here:
- WordPress Troubleshooting: Unable To Log Into WordPress Administration Area
- Troubleshooting Checklist
- Unable To Log Into WordPress Administration Area? Try These Methods
- If You Still Cannot Log Into Your WordPress Administration
WordPress Troubleshooting: Unable To Log Into WordPress Administration Area
Sometimes errors can cause WordPress login problems, or make your WordPress dashboard unavailable, preventing you from accessing plugins, themes and other important information on your site.
In this section, you will learn what to do if you are unable to log in or regain access to your WordPress Administration area.
Have you established that the problem / issue is not related to:
- Security threat (e.g. brute-force attack)
- Forgetting password
- Getting locked out by another user with administrator privileges
- Plugin Errors
- Theme Errors
- Firewall blocking you from logging into WordPress (Disable your firewall and try to log in again).
If none of the above are possible reasons, try one of the solutions listed below.
Unable To Log Into WordPress Administration Area? Try These Methods
Can’t log into your WordPress Administration area? Try the methods below:
Method 1: Edit Users Table
For this tutorial, you will need to have access to a cPanel hosting account and phpMyAdmin.
Log into your cPanel administration area …
Click on phpMyAdmin in the ‘Databases’ section of your administration panel …
This takes you to the main ‘phpMyAdmin’ section …
Click on the MySQL database associated with your WordPress site …
Most default WordPress installations automatically assign the suffix “wrdp1” to the database.
Note: Several WordPress installations are shown above – make sure to choose the correct database for the site you are trying to log into. On multiple WordPress installations, suffixes “wrdp2”, “wrdp3”, etc are assigned. In the example above, the database name is “wptod1”, and we are going to use the “wrdp3” installation for this tutorial.
Click on the database name to load the MySQL data tables structure into the main window of your phpMyAdmin panel …
Click on the wp users table in the left menu (default is wp_users, or yourprefix_users if you defined a different table prefix), or ‘wp_users’ in the main window …
Make sure that you are in the ‘Browse’ section, and click on the ‘Edit’ link in the database row of the admin user …
Delete whatever is currently in the password field (‘user_pass’) …
Enter a new password …
Note: Make sure to enter a strong password into the ‘user_pass’ field.
To learn more about creating strong passwords, see the tutorial below:
From the ‘user_pass’ row’s Function drop-down list, choose MD5 …
Click ‘Go’ to save the new information in the database …
Your new password will be made secure in the database via the MD5 data encryption method …
Log into WordPress using your admin username and the new password you have just created …
Your WordPress admin access should now be restored …
Congratulations! Now you know how to regain access to your WordPress Administration area by editing your Database’s ‘WP Users’ table.
Method 2 – Edit ‘functions.php’ File
Use the method described below if you have changed the URL of your WordPress installation in the General Settings‘ section, and find yourself unable to log back in.
In order to complete this tutorial, you will need to edit a WordPress installation file called ‘functions.php’. We provide a step-by-step tutorial below that you can follow and a downloadable template. If you don’t feel comfortable editing files, however, then seek help from professionals.
Changed General Settings URL And Can’t Log Back In
On single WordPress installations, the Settings > General screen contains two fields where URLs are entered:
- WordPress address (URL) – also known as the “Home” URL setting. The “Home” setting is the address you want people to type in their browser to reach your WordPress site.
- Site address (URL). also known as the “Site URL” setting. The “Site URL” setting is the address where your WordPress core files reside.
The above fields are important settings, as they control where WordPress thinks your site is located. These settings control the display of the URL in the admin section of your page as well as the front end, and are used throughout the WordPress code.
Note: Both settings should include the http:// part and should not have a slash “/” at the end.
There may be instances where the URLs in these fields may need to get changed for some reason, or get accidentally changed (i.e. mistakes, typos, etc.), and you discover that your site no longer works properly, or it is being redirected to another URL, leaving you unable to log into your WordPress admin area.
If you have changed the URL values incorrectly, and you have access to the site via FTP, then follow the method below to quickly get your site back up and running:
Open your FTP application and connect to your site, then open the ‘public_html’ folder …
Locate the ‘functions.php’ file inside your active theme folder …
Transfer a copy of the file to your hard drive. We recommend making two copies: one for editing (see below), and one to keep as an original backup in case something goes wrong and you need to reinstall the original file …
You will need to edit the ‘functions.php’ file to make the necessary changes that will give you access again to your WordPress Admin area.
Open the ‘functions.php’ file using a simple text editor (e.g. notepad) …
Note: to view a .php file in notepad, make sure to select ‘All Files’ from the file type drop-down menu, not the default (i.e. ‘Text Files (.txt)’) …
Add these two lines to the file, immediately after the initial “<?php” line …
Make sure to replace “yoursite.com” with your own site’s URL.
Note: If your site is installed in a sub-directory (e.g. ‘http://yoursite.com/blog’), then make sure to use the correct URL.
Your file should look like the example shown below …
Save the file and re-upload it back to your site, replacing the original ‘functions.php’ file in the same location.
Visit your login page. You may need to try a couple of times before the site comes back up.
Log into WordPress using your admin username and password …
Your WordPress Admin access should now be restored …
Once your site has been restored and is up and running again, repeat the above steps, then open the ‘functions.php’ file, remove the two lines you previously added, resave the file and re-upload it to your site without those lines.
Method 3: If No ‘functions.php’ File Exists
If there is no ‘functions.php’ file in your WordPress theme, follow the steps below to create one, or just download the template ‘functions.php’ file provided below.
If your theme does not have a ‘functions.php’ file, download the sample functions.php file below, then edit it as shown in the tutorial above and upload it to your server. Download file is in .zip format:
How To Create A functions.php file
Create a new blank text file using notepad …
Add the code below to the file, replacing “yoursite.com” with the URL of your site …
Save the file as ‘functions.php’ (remember to choose ‘Save as type: All Files’ before saving) …
Upload the new file to your theme directory (‘/public_html/wp-content/themes/themename‘), then visit your login page and try to login.
If login is successful, return to your FTP screen and delete the ‘functions.php’ file from your themes folder, as this file did not previously exist for that theme …
Congratulations! Now you know how to regain access to your WordPress Administration area by editing your theme’s ‘functions.php’ file.
If Editing The functions.php File Doesn’t Work
If editing your functions.php file does not work, then refer to the ‘How To Manually Override Your WordPress Login Details’ section in the tutorial below:
If You Still Cannot Log Into Your WordPress Administration
The WordPress Codex provides a list of possible reasons why you may have been locked out of your WP Admin area with solutions that will require you to edit some of your installation files.
This includes the following:
- WordPress MultiSite Network error
- Corrupted wp-login.php file (New Login File) – file may have been corrupted or uploaded incorrectly.
- Site URL Redirecting – In certain cases your WordPress address URI may have been reset. Or, you may have changed your WordPress address URI and can still access the login page, but cannot login or access the database.
- Issues with subdomains or subdirectories
- Issues with secure browsing (Secure HTTPS)
- Issues with your URL Options – In some situations, your site can be seen from inside your domain, but not outside.
If you suspect that any of the above reasons may be the cause of your difficulties logging into WordPress, then visit the WordPress help page below for possible solutions:
Additionally, check the ‘Tutorials’ section below or see the additional resources links in this tutorial:
Now that you know about different methods to regain access to your WordPress admin area, click on the link below to view the next section of our WordPress Troubleshooting Guide.
To learn what to do if you are experiencing WordPress errors related to plugins, see the tutorial below:
"Your training is the best in the world! It is simple, yet detailed, direct, understandable, memorable, and complete." Andrea Adams, FinancialJourney.org
Disclaimer: We have no association with WordPress or any of the products mentioned or reviewed on this website. We may receive affiliate commissions or financial benefits from sales of any third-party services or products advertised on our website. All images and descriptions sourced from product websites are the copyright of their respective owners and have been used only for illustrative or training purposes.
Was this article useful? If so, please take a moment to use the links below to share this tutorial with other WordPress users.