When migrating from our server to our client’s server we ran into a strange problem. Basically whenever the user tried to login at /wp-admin. They would be sent into an endless loop. This loop would send the user back to the login page as though nothing happened. After hours of work, we finally fixed this error… along the way I found out that there are any many different issues that may be causing this loop. So here is the way we troubleshooted the problem. Below are tips to troubleshoot your endless login loop issue for WordPress. I hope one of them works for you.
The first attempt – Delete cookies
Try deleting your browser’s cache and cookies. Once this is done restart your computer. If this doesn’t fix the problem then I am sorry.. continue to number 2. If it does work… your welcome and you’re lucky.
Fix number 2 for the login loop – Set cookie path
Go to your wp-config file and add the following to the top right after <?php add the following:
Now try accessing the backend. If that doesn’t work delete the added code.
Attempt number 3 – Check permissions
On this one check to make sure your WordPress permissions are correct. Specifically the wp-login.php. I would recommend setting the folders and files to either 644, or 755. If you use 777 make sure you set it back to something else… 777 is never the correct answer.
That didn’t work? now try number 4 – Delete .htaccess
If two did not work try deleting your .htaccess file or backing it up. Rather than deleting your .htaccess, I recommend renaming it to .htaccess-2 or .htaccess.bak. If this fix doesn’t help then restore your .htaccess file.
Troubleshooting tip number 5 – Check MySQL
Connect to your database ( via PhpMyAdmin for example) and find the wp_options. Click on it. Then click “check all” and hit the browse button which is between “with selected” and the pencil graphic. Next look for an option name that is “active_plugins”, which is probably located on page 2 by default because it has an option_id of 36. Once you find it click on the pencil located to the left hand side. Copy and delete everything in the text field option_value and replace it with the following code:
Then hit go. This will deactivate all of the plugins associated with the wordpress site. It will probably make your site look strange temporarily because the plugins are deactivated.
Then try logging in… again… If that doesn’t work paste your code back into the section you just edited and move on to number 5.
Number 6-7, the nuclear option – Reinstall WordPress
Number 6. Before you reinstall WordPress CHECK YOUR PHP VERSION AGAINST THE WORDPRESS VERSION. I learned this the hard way.
Number 7. Give up and just try to re-install wordpress under a fresh directory like “/test”. See if there any errors during the installation. In my case the owner of the server failed to inform us that they don’t keep their php up to date. So we where trying to load a php 5.2 software onto php 5.1…. WHOOOPS… With that piece of information we were able to fix the issue very quickly.