Are you unable to log into your WordPress admin (/wp-admin) dashboard? Are you receiving an error message? Don’t worry, it’s a common error and there’s more than one solution. In this tutorial, we’re going to cover a few ways of solving this problem.

Reset admin user password

If you can’t log into your Admin Dashboard it could be that you have the incorrect password. But, there’s a quick solution; you can always reset it.

Here’s 3 few ways to reset your admin password.

Resetting admin password with email access

First you want to navigate to your WordPress Admin Login page.

This will be located at the following URL,

 http://www.yourdomain.com/wp-admin/

Click on Lost your password? underneath the Username and Password fields.

When prompted, enter the username or email address of the admin account and click Get New Password.

Click on Lost your password? link

Enter your admin username or email address

A temporary password will be emailed to you. You can always choose to change it once you’ve successfully logged back into your site.

Resetting admin password in the WordPress database

If you no longer have access to your email, you can reset your password by editing the WordPress database using phpMyAdmin.

phpMyAdmin is an open source MYSQL database administration tool which is quite popular and is usually included with most web hosting accounts.

Start by logging into your hosting account / cPanel account.

Under the DATABASES section you’ll see a link for phpMyAdmin. Click on it.

phpMyAdmin located in cPanel hosting account

When phpMyAdmin opens, you’ll see a list of database names. Locate the one for your website and click on it.

If you’re unsure of the name of your database, look inside the wp-config.php file located in the root directory of your WordPress site.

Look for the following code:

/** The name of the database for WordPress */
define('DB_NAME', 'your_db_name');

In phpMyAdmin, when you select your database name, a list of table rows will be displayed.

Locate the wp_users table row.

wp_users table row in phpMyAdmin

Click on wp_users.

The wp_users table will list all the user accounts on your site and their passwords. However, it’s the admin user that you’re interested in.

Click Edit next to the administrator username.

From the Functions dropdown, select MD5. In the value field, enter your new password.

Change admin user password in wp_users table

Then, save your changes and try to log into your Admin Dashboard with the new password.

Note: Using phpMyAdmin to edit your database may break your website. Make sure to download a backup of your database before you make changes.

Reseting admin password by editing functions.php file

If the previous two solutions didn’t work to reset your password you can always resort to editing the functions.php file.

The file is located in your themes directory and not in the WordPress root directory.

The path to your themes directory looks like this,

/public_html/wp-content/themes/twentyseventeen

Connect to your site via FTP or access the File Manager from within your hosting account and navigate to the functions.php file for your active theme. For example:

public_html/wp-content/themes/twentyseventeen/functions.php

Edit the file and add this code to it, right at the beginning, after the first <?php:

wp_set_password( 'password', 'admin' );

Put in your own new password for the main admin user. The “admin” is the administrator user ID in the wp_users table.

Note: In this instance, our username is ‘admin’ and our chosen password is ‘password’.

Then, save your changes and try to log into your Admin Dashboard.

If you can, visit My Profile to set a new password and save your changes.

The final step of this solution is important.

Once you’ve changed your password, you need to re-open functions.php and delete the code you just added.

If you don’t, WordPress will continue to reset your password.

Enable cookies and clear cache

Although you can disable cookies in your browser (Chrome, Firefox, Safari & Edge), I don’t recommend it when working with WordPress.

WordPress requires cookies to function properly, and some errors can be cookie-related.

Check to ensure that your cookies are enabled in your browser. If they aren’t, enable them.

After enabling the cookies, you should then clear your cookies and cache.

You can also do this in Windows by hitting the ctrl+shift+del keys and on Mac with cmd+shift+del keys.

Once your cache has cleared, reload your page and try to log in again.

If it’s still not fixed, it could instead be a plugin issue.

Disable plugins

If none of the above steps have worked, it’s likely that you’re dealing with a faulty plugin. This is a common cause of many WordPress errors.

That said, there’s no way to tell which plugin is causing the problem.

So, you must deactivate all of them at once, then re-enable them one by one.

You can do this via FTP or with the File Manager within your hosting account.

Locate the plugins directory within your WordPress installation. The path is:

public_html/wp-content/plugins

To disable all your plugins at once, simply rename the folder to plugins_backup.

Now, try to log in to your site again.

If you’re able to log in then you know one of the plugins is the cause of the problem. However, you don’t know which one.

This is why you now need to change the plugins folder back to it’s original name and deactivate the plugins one-by-one by renaming them.

Once you’re able to log in again you will have found the problematic plugin.

Deactivate your currently active theme

Like plugins, themes can also cause their share of problems.

To see if your active theme is the cause of the problem, you can switch to another theme.

Follow the same steps you completed to disable the plugins but instead navigate to the themes directory.

public_html/wp-content/themes/

In that directory you’ll see a list of theme names.

Rename your current active theme folder and try to login again.

If deactivating your theme didn’t work either, let’s move on to the next fix.

Disable .htaccess file and create a new one

If you’re logging in and being redirected to a 404 error page, you can fix this a couple of ways. Disabling .htaccess is one of them.

To do this, go to your WordPress root directory and locate the .htaccess file.

WordPress htaccess file location

Re-name the file to .htaccess.old and try to log in.

If you’re able to log in, all you need to do now is to generate a new .htaccess file.

You can do this in your Admin Dashboard by going to Settings > Permalinks and clicking SAVE. Doing this will regenerate the .htaccess file.

Update your site URL

If creating a new .htaccess file didn’t work, you can try to update the URL of your site via FTP or with the File Manager within your hosting account.

To update your site URL, you have to edit the wp_config.php file. This file is also located in your WordPress root directory.

Edit the file and add the following code:

define('WP_HOME','http://www.yourdomain.com');

define('WP_SITEURL','http://www.yourdomain.com');

This will refresh the URL where your WordPress files are located and also the URL to your homepage.

If you’ve tried all of the above issues and still can’t log in, I suggest contacting your hosting provider for assistance.

Feel free to let us know in the comments below if any of these solutions worked for you.

Published by Hans Desjarlais

Founder @ Themely, entrepreneur and travel addict. Always learning, maverik at heart, speaks 3 languages and hope's to go to space one day.
css.php

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match