How to fix WordPress login redirect loop

Problem

When trying to log into a WordPress website, using the wp-login / wp-admin page – the page redirects back to the login page after entering in the username and password.

No error message is displayed – the username and password is correct.

Solution

Test 1 – can you login using another browser?

To help you understand the cause of the issue – open another browser (or a new ‘private’ window) and try to login.

If you can login – the issue is not with the website. Most likely a bad ‘cookie’ or browser addon.

If you can’t login – the issue is likely with the website. Most likely bad code in a plugin or the active theme.

Method 1 – Clear page cookies

Note: these instructions are for Firefox and will differ for other browsers.

  1. With the page open, press F12 on your keyboard
  2. The debug / developer tools will open at the bottom of the window
  3. Open the ‘Storage’ tab
  4. In the left hand, expand ‘Cookies’
  5. Right-click on the website’s name and click ‘Delete All’

Method 2 – Delete all browser cookies

Note: these instructions are for Firefox and will differ for other browsers.

  1. With the page open, press Ctrl + Shift + Delete on your keyboard
  2. For ‘Time range to clear’ select ‘Everything’
  3. Tick ‘Cookies’ and ‘Cache’ – you can leave other options un-ticked
  4. Click ‘Clear now’

Method 3 – Try temporarily disabling all plugins

  1. Access the website server using your preferred method – for example FTP or cPanel
  2. Browse to the /wp-content/ directory
  3. Rename the /wp-content/plugins/ directory – for example to plugins_backup
  4. Try to login again – if you can now login the issue is with one of your plugins
  5. Change the directory name back to plugins

How do I find out which plugin has the problem?

You will need to repeat the process for each of the plugins.

  1. Oopen the /wp-content/plugins/ directory
  2. For each of the plugins, temporary rename (e.g. add _backup)
  3. Try to login again – if you can now login the issue is with that plugin
  4. Change the directory name back if it is not causing the issue

Method 4 – Try temporarily disable your active theme

  1. Access the website server using your preferred method – for example FTP or cPanel
  2. Browse to the /wp-content/themes directory
  3. Rename the directory for your active theme – for example to my_awesome_theme_backup
  4. Try to login again – if you can now login the issue is with your active theme

Method 5 – Specify site URL

  1. Access the website server using your preferred method – for example FTP or cPanel
  2. Browse to the root directory for your WordPress installation
  3. Edit the wp-config.php file
  4. At the top of the file, just after <?php add the following lines
  5. Don’t forget to use the address for YOUR website
  6. define('WP_HOME','https://www.wpdevguides.com');
    
    define('WP_SITEURL','https://www.wpdevguides.com');

Method 6 – Rename .htaccess configuration file

Note: these instructions only apply to Apache hosted websites. NOT nginx.

  1. Access the website server using your preferred method – for example FTP or cPanel
  2. Browse to the root directory for your WordPress installation
  3. Rename the .htaccess file – for example to .htaccess_backup
  4. Try to login again – if you can now login the issue is in your .htaccess configuration
  5. Now you are logged in – you can generate a new .htaccess file by going to Settings > Permalinks and clicking ‘Save’
  6. If you are still not able to login – change the file name back to .htaccess