Even when the user name and password are typed correctly, WordPress will sometimes refresh the page and redirect the user or administrator back to the login screen. In this article, you will learn how to fix WordPress admin login page refreshing and redirecting issues.
The WordPress login page redirecting back to the login page problem can occur in many situations. We have faced it for example in the following situations:
- The entire site was copied from another domain to the new domain. (for example from .com to .net etc.)
- A new plugin or theme was installed.
- The site was moved to a new hosting provider.
- Just out of the blue, without any clear reason (these are most likely cookie or .htaccess related problems).
Delete and enable cookies to resolve login problem
Cleaning cookies and the cache is the first thing you should try. It is also the most common cause of the WP login page redirect problem, and it is also the easiest to fix.
WordPress requires cookies for authentication, and occasionally these just end up being broken. You can try a different browser or simply go to the settings tab of your current browser and clear the cookies and cache. But be careful not to wipe any cookies you don’t want to throw away. The majority of browsers offer the option to delete cookies based on the domain. If you want to keep other cookies, you should choose that option.
Making sure that cookies are enabled is another cookie-related fix for the issue. If you don’t accept those, WordPress won’t let you log in. This might be the case, particularly if you’re trying to log in using a device other than your regular computer. Therefore, make sure cookies are enabled.
Please note, that you should restart the browser and/or computer after cleaning the cookies.
Deactivate all WP plugins and custom scripts
A conflict between two or more plugins can cause the wp-login page to keep refreshing. If you have just installed some new plugin and can’t log in to wp-admin anymore – then just disable the plugin, and you should be able to login again.
Plugins can cause problems even if no new plugin has been installed, maybe you have updated some plugins or some plugins could have been automatically updated without admin’s knowledge. New version(s) could cause conflict. In these cases, you can try to enable login again by disabling all the plugins.
How to disable all plugins if wp-admin login does not work?
You can just add for example 0_ for each directory name, and go those through one by one. You can try to log in after each rename, and test if the plugin you have just renamed is the cause of conflict.
You can also rename the whole plugins directory for example to 0_plugins, and test if you are now able to login.
If you have added some custom code to the active theme functions.php file, you should consider removing it, if disabling all the plugins does not help.
Delete the .htaccess file(s)
In some cases, the .htaccess file can also cause problems. It could be because some plugins you have just installed that have modified the .htaccess file or you might have switched on some security features that have done modifications to the file.
You should use FTP client such as WinSCP or file manager through cPanel to navigate to the root directory and delete the .htaccess file. Check out if there is another located in the admin directory, if there is, delete that one as well. However, before deleting those, make sure you have backups of those. You can get back up just by downloading the file using an FTP client.
If you can not find the .htaccess file, make sure that you have at FTP client settings or cPanel File Manager the “show hidden files” enabled. These so-called “dot files” are in most cases hidden if using default settings.
Try login, if it works, you found the problem. Now you can create the new .htaccess file by just navigating to the WP admin to Settings » Permalinks and clicking save. It updates the permalink structure and creates the new .htaccess file.
Define the site URL in wp-config.php file to fix the WP login redirect
In some cases like website migration or domain change, updating / defining the site URL in the wp-config.php file helps. You should use FTP client such as WinSCP or a file manager through cPanel. Navigate to the root directory and open the wp-config.php file in the editor.
Then find the line:
/* That's all, stop editing! Happy blogging. */
And add the following two lines before it (remember to change domain.com to your own domain, and check out if your site uses http:// or https:// and if the domain resolves with or without the www):
Now you can try to log in!
Let us know which solution worked for you or if you have any questions!
Hopefully, this article was helpful. Please post a comment below and let us know which solution worked for you! If you have any questions about the WordPress login redirect problem, please don’t hesitate to ask.
If you like our WordPress help, give us a share! It’s just one click 🙂