Last updated - February 25, 2020
WordPress is one of the most common content management systems in the world. One of the reasons for its popularity is the ease with which even beginners can handle it well. Moreover, WordPress offers great flexibility for customization as it provides great scope for tweaking code and adding extensions. Though it is quite easy to manage, WordPress occasionally presents a few challenges to beginners with certain errors. A type of error that WordPress users encounter frequently will be login errors. In this article, we will discuss how to troubleshoot common WordPress login errors.
This can happen to any WordPress user, nevertheless it can cause a fair bit of trouble. WordPress offers a set of solutions to troubleshoot this error. We will look into a few of this here in this article.
Click the “Lost your password?” link
If you have forgotten your password, you can click this link on the login window, and a password reset link will be sent to your registered email. This is one of the easiest solutions when you have lost or forgotten your password. However if you are not able to access the registered email id, this won’t be of much help.
Change the password on the user profile
Now if you still have administrator access to WordPress, and one of the users have a problem with login, you can go to the profile and change the password. Simply go to the user profile, scroll down to the Account Management section and click the Generate Password button. WordPress will automatically generate a strong password, which you can keep or type in a new one.
Update through MySQL command line
If you are comfortable with coding, you can use an MD5 string of your password. You can get this by a range of options. Simply access this tool, create a key with Python or create a file called wp.txt with nothing but the password. With the newer versions of MySQL, you can use MySQL itself to create the MD5 hash for you. Login to your MySQL and select WordPress database. Find the user id and update the MD5 string with the password.
If you have access to phpMyAdmin, you can update the password by using this strategy as well. However, WordPress advises only advanced users to attempt this. If you are a developer, you can find the steps to change the password through phpMyAdmin here.
You can update the password through FTP as well if you have administrator rights. You can login to the site via FTP and download the theme’s functions.php file. Include the following line to this file right after the first <?php
wp_set_password( 'password', 1 );
Enter the new password for the admin user and upload the file back. Once you are able to log back in to your site, remove this line of code, or it will reset the password for every page load.
Using emergency password reset script
This is an option that you can try if none of the other options work. It is better to help expert help to perform this if you are a beginner of WordPress. The steps to reset the password using this PHP script is detailed here.
Sometimes, even if you have the right password, you may not be able to login correctly to WordPress admin. This is probably because the admin has revoked your user access. It is a probability if you are just an occasional user of the site. The site administrator must have previously provided you a temporary access and must have revoked it later. Or, the entire user profile must have also been deleted. If you are not able to reset the password with Lost your password link, it is best to contact the site administrator to set up a new profile.
Sometimes cookies are blocked on your browser and that can lead to a WordPress login error. To troubleshoot, you can simply ensure cookies are enabled on your browser, and then clear the cookies and cache.
Corrupted login file or .htaccess file
Sometimes the WordPress login error is caused due to a corrupted file. One of the possibilities is that the wp-login file is corrupted.
By installing this file again, you will be able to resolve the issue. Basically, you will have to delete the wp-login file from your server, and then upload a new copy by downloading WordPress fresh again.
You can also edit the wp-login file by going to the ‘case retrievepassword’ section. Here, you can replace
$user_login = $user_data["user_login"]; with
$user_login = $user_data->user_login;
The WordPress login error can also be due to a corrupted .htaccess file. If this the case, you can delete the corrupted .htaccess file and resolve the issue. Let’s see how you can manage this. Find the .htaccess file on your website through FTP or file manager. Create a copy of the file and delete the original. Try logging in to WordPress. If you are able to login now, you can safely assume the problem was due to a corrupted .htaccess file. Now, you can simply go to Settings > Permalinks and simply click the Save changes button to restore the .htaccess file back on the server.
Changes to the website
Any recent changes made to the site can also be a cause for WordPress login errors. The following changes on your website can be preventing users from a smooth login to your site.
- SSL certificate recently installed
- A security plugin that asked you to change the wp-login or wp-admin address.
- Created a multisite and the network name or subsite address changed.
You can verify all these details are correct by logging in to phpMyAdmin.
If your WordPress Address url or site address url are wrong, it can create issue with login. You won’t even be able to access the admin area to correct the mistake. Any recent migration or movement of WordPress core to a subdirectory could cause the problem.
If you suspect this could be the reason for the login problem, you can fix it using the following step.
Verify the siteurl value in the wp-options table in the WordPress database. Correct it if seems incorrect. Now, open wp-login.php in a text editor and delete the following lines
if ( dirname( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_settings('siteurl') )
update_option( 'siteurl', dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) );
After changing your WordPress url, if you are not able to login or access the database, then you can update the wp-login file with the following code to reset the address.
update_option( 'siteurl', 'http://your.domain.name/the/path' );
update_option( 'home', 'http://your.domain.name/the/path' );
Once the database is updated, you can remove these lines.
The white screen of death
You might have encountered this error if you have tried to make some code level changes when you are really new to the WordPress environment. If you add a code snippet wrongly in the backend, this can happen. Let’s see how you can troubleshoot if you encounter this error.
One option would be to go back to the file that you have edited and spot the mistake that you made. If you are not able to spot the mistake, you may have to install WordPress again. Or, you can revert the site to one of the last saved backups.
One of the best ways to avoid getting this error frequently would be to save a copy of the file before you make any changes to it.
When you try to install a file that is too large for your server to process, it can give an error. However, in most cases it won’t prevent you from logging in. You can remove those files from the server and get things back to working order again.
If you are looking to avoid this error in the future, you can adjust maximum limits set on the wp-config.php file. Find the line with ‘wp_memory_limit’, and change the default value to a higher number. For example, if it is 64M, increase it to 98M or 128M. This should allow you to install the file without problems next time.
Plugin or theme conflict
When you install a theme or plugin, there can be conflicts that will prevent you from logging in. In this case, it is important to identify which specific plugin or theme has created the problem and then change it.
In the case of plugins, if you already know which plugin has created the problem, it is simple. You can remove the plugin and the issue will be resolved. However, if you don’t have a clear idea as to which plugin has caused the problem, you need to disable all the plugin. You can do this from the admin panel or by accessing the /wp-content/plugins/ folder. Alternatively, you can rename the plugin folder and change it back to the original once you recover the WordPress installation.
If you think the theme is causing a login error, you can use FTP to rename the active theme folder (/wp-content/themes/). Your site will switch to the default WordPress theme now. After this step, you can login to the admin and change the theme.
If you want to find out the reason for the trouble with the theme, you can run the following code while the theme is still running.
Sometimes you may see an “error establishing a connection”. This could be due to internet connection problems. If that is not the case, there might be a problem with your hosting service provider. You need to make sure that the server is not facing any downtime. This could also be a security breach on your site that has prevented you from accessing your site.
Watch the video explaining the common WordPress errors and how to solve them.
If you tried all the above steps and still not able to login to your WordPress admin, you can try raising a topic on WordPress support forums. Hope you got a good idea on how to troubleshoot common WordPress login errors. Please leave us a comment if you have a query.