cannot login to wordpress admin

cannot login to wordpress admin

Can’t login due to redirect loop

If  you have multiple WordPress installs on your server you may come across redirect loops. Once you’ve increased the number of your multisite installs beyond one, then you’re likely to be unable to login as you’ll get stuck in a redirect loop. That is, every time you try to login, you’re returned to the login screen.

Why Does This Happen?

Basically, each version of WordPress, regardless of its domain or subdomain, maps to a single IP address. In this case,

When a request comes into the server, part of the request includes the domain. A domain is associated with an IP address. When a cookie is created, it includes the name, some sensitive content, and then the path. As such, when you attempt to login to a WordPress installation on a different domain (but on the same IP), the cookie is essentially invalid.

Sure, clearing the cookies will do the trick, but users shouldn’t have to do that. Additionally, not everyone will see this problem occur, but if you’re in the business of managing a multisite installation in a shared environment, then you’re likely to see it.

The code below will ensure that WordPress is clearing the cookie for the given domain of the multisite thus allowing the login process to set it correctly.

In your wp-config.php file, add the following lines of code:

1define('ADMIN_COOKIE_PATH', '/');
2define('COOKIE_DOMAIN', '');
3define('COOKIEPATH', '');
4define('SITECOOKIEPATH', '');

Can’t login due to changed url

If you accidently changed your url (Ex. From to in your admin settings you can use this to fix it:

Try placing:
<?php update_option('siteurl',''; ?>
in your theme’s functions.php.

Other login problems

  1. Other ways to fix login problems is to clear your browser cache and/or cookies.
  2. Disable all of your WordPress Plugins, either through the admin panel or by removing them from the /wp-content/plugins/ folder, so they will not be recognized by the program.
    1. Alternatively, you can rename the plugins folder to something else temporarily to something like /wp-content/pluginsXX/ and they will not be recognized. Rename the folder back to /wp-content/plugins/ once the base WordPress installation has been recovered.
  3. Deactivate your theme
    1. Rename the active theme folder (in wp-content/themes) by using FTP. Once renamed, WordPress will revert to using the WordPress Twenty Fourteen theme. When finally logged in, change to a different theme.
    2. To find out what caused problem in the theme, upload and run this code when the theme is active:
    3. <?php ini_set(‘display_errors’,’1′); ini_set(‘display_startup_errors’,’1′); error_reporting (E_ALL);include(‘index.php’); ?>
  4. New Login File
    1. Sometimes the wp-login.php file may have been corrupted or uploaded incorrectly.
    2. Delete wp-login.php off of your server and upload a new copy from a fresh WordPress download. Remember, overwriting file via FTP can lead to incomplete transfers.
    3. Edit wp-login.php as follows
      1. Go to the case retrievepassword section, found under this comment:
      2. // redefining user_login ensures we return the right case in the email
        $user_login = $user_data["user_login"];
        $user_login = $user_data->user_login;
  5. Edit Users Table
    1. Access your site’s phpMyAdmin and edit the database carefully.
      1. Open the WordPress database.
      2. Click on the users table in the left menu (default is wp_users, or yourprefix_users if you defined a different table prefix.)


Click on the EDIT button next to the admin user.

Delete whatever is in the password field.

Enter your desired password.

From the Function drop-down list, choose MD5.

Save the info in the database.

Log in to WordPress using “admin” and the password you used.

In the case of newer versions of WordPress, the password is double hashed, but as long as you md5 the password, it will complete the hash (it upgrades your password for you).

There are no comments published yet.

Leave a Comment