How To Fix “Can’t Access WordPress Admin” Error

wp-admin
News / Tips

How To Fix “Can’t Access WordPress Admin” Error

If you can’t access WordPress admin of your site, it spells a world of trouble. You won’t be able to make changes to your website or fix any errors. But worse, it could mean that a hacker has taken control of your site and locked you out. This problem is quite common, so if you follow this guide you’ll have access back in no time.

Why Did You Lose Access To WP Admin?

The most common reasons you can’t access your WordPress admin are:

  1. A hacker has broken into your site and removed your admin privileges
  2. You’ve made too many login attempts and are locked out of your site
  3. You’ve changed your login URL and now can’t remember your custom login URL
  4. You’re unable to recover your password using the ‘Recover Password’ option
  5. You’re encountering errors on your wp-admin login page such as:

– PHP error

– Error establishing database connection

– HTTP 500 internal server

– White screen of death

– Parse error

There may also be other errors that cause you to lose access to wp-admin, but these are the most likely causes.

   So, How To Fix Can’t Access WordPress Admin?

We suggest you work your way down these fixes, as we’ve listed the most likely solutions first. In case you’ve already tried a few solutions out, jump directly ahead to the solution you haven’t tried yet.

IMPORTANT NOTE: If you have access to set up a staging site using your web host or a WP staging plugin, we recommend carrying out the steps on a staging site and not directly on your live site. Some measures are technical in nature and a slight misstep can make the situation worse. A staging environment is a clone of your website where you can experiment and troubleshoot to find the solution that works. So you can implement only the right solution on your live site.

  1. Manually Reset Your Admin Password Via phpMyAdmin

By default, WordPress allows you to make an unlimited number of login attempts. This means you can try different usernames and passwords until you hit the right one. But if you had limited login attempts on your site, either manually or by using a plugin, you might find yourself locked out. If you’re unable to remember your password, and you’re also unable to retrieve it using the ‘Forgot Password’ option, you can reset your password through your web hosting account. Even if a hacker has locked you out of your account, you should be able to create a new user account in this way to regain access to your site.

  1. Log into your web hosting account and access cPanel.
  2. Here, under Databases, select phpMyAdmin.
  3. Next, select your website’s database.
  4. Inside your database, you’ll see a number of tables displayed. Select wp_users and edit it.

You will be able to create or edit users here, and set passwords. Locate your username, and under user_pass, in the Value field, enter the password of your choice. Finally, save your changes. Now when you access your WordPress login page, you can use the new login credentials and enter your wp-admin panel.

  2. Restore Your Backup

You may have taken a backup either using a plugin or through your web host. If you have a backup, we recommend restoring your backup. This will remove any recent errors that have popped up on your site. After restoring your backup, you will be able to access your wp-admin page and log in as usual. We suggest that you still troubleshoot to find out the root cause of the problem so that the error is fixed permanently.

  3. Disable Your Plugins

Sometimes plugins can be the culprits behind these errors on your site. Since you don’t have access to wp-admin, you’ll need to disable plugins manually. Log into your hosting account and go to cPanel > File Manager.

Open public_html and open the wp-contents folder.

Find the folder called Plugins and rename it to Plugins_Disable.

Now check if you can access your wp-login page. If you can, then a plugin is causing an incompatibility or conflict issue on your site. You can log into wp-admin, and then activate your plugins one at a time. Each time, reload your site to check which plugin is causing the problem.

  4. Scan Your Site

When hackers manage to take control of your site, they immediately lock you out. They remove your admin privileges so that they can run their malicious activities for as long as possible. If you suspect a hack, you need to scan for malware immediately. Since you don’t have access to wp-admin, this can be tricky. Here’s what we suggest:

  1. If you’ve installed a malware scanner on your site, you’ll have access to an independent dashboard to run a scan remotely without having to log into WordPress
  2. Use external online scanners like Virus Total to run a malware scan
  3. Check if your website has been flagged by Google for being hacked on Google Safe Browsing
  4. Check the Security tab in your Google Analytics account

If you detect malware on your site, you’ll need to clean it up. If you’re subscribed to a security plugin, you can clean it up easily by clicking on the Auto Clean button. If you haven’t yet signed up, you won’t be able to install a security plugin on your site since you’re locked out. You can also attempt to manually look for malware on your site. However, we don’t recommend it because manually scanning for malware on your own is not effective. It requires technical and security expertise.

IMPORTANT NOTE: Before we proceed with the next steps, if you haven’t taken a backup of your WordPress site, we recommend you backup your site immediately. These steps can be technical and involve modifying your WordPress files and database.

  5. Re-upload wp-login.php

If you’re unable to access the login page of your WordPress site, it might be because your wp-login.php file was moved or deleted. To fix the problem, you need to reupload this file.

  1. Download a fresh WordPress installation on your computer. Unzip this file, look for the wp-login file and keep it ready.
  2. Log in to your web hosting account. Access cPanel > File Manager > public_html.
  3. Using the upload option, upload the wp-login file from your computer to this public_html folder. You can overwrite the old file if it is present.
  4. Open the wp-login file by right-clicking on it and selecting Edit.
  5. At the end of the file, copy-paste this code:

// Delete this line

$user_login = $user_data[“user_login”];

// Replace it with this line

$user_login = $user_data->user_login;

6. Save your changes and you should be able to log into your WordPress admin account now.

  6. Generate A New .htaccess File

The .htaccess file is one of the most sensitive files of your WordPress site. Sometimes, the smallest error in this file can break your site and cause you to lose access to your wp-admin panel. You can try deleting the old .htaccess file and generating a new one to fix the issue.

  1. Log into your web hosting account. Access cPanel > File Manager > public_html.
  2. Find the .htaccess file and download it so that you have a backup copy.

TIP: If you can’t find the .htaccess file, go to Settings and check the box Show Hidden Files.

  1. Next, delete the .htaccess file and try accessing your WordPress login URL.

4. If it worked, once you’ve logged into your wp dashboard, go to Settings > Permalinks and Click Save. This will automatically generate a new .htaccess file. If this didn’t work, reupload your .htaccess file that you downloaded earlier.

  7. Disable Your Theme

Similar to plugins, your theme may also be causing your wp-admin page to disappear. To disable your WordPress themes manually:

Log into your hosting account and go to cPanel > File Manager.

Open public_html and open the wp-content folder.

Find the folder called Themes and rename your active theme’s folder with the suffix _disable. This will automatically activate a default WordPress theme.

Now check if you can access your wp-login page. If the error has disappeared, then your theme was causing the issue.

TIP: If you have multiple themes installed, even if you aren’t using them, they could still cause conflicts and incompatibility issues. We recommend deleting all extra themes and only keeping the one you’re using.

  8. Check File Permissions

WordPress has file permissions that grant different levels of access to different users of your WordPress site. You can change access to read, write, and execute files on your site. We recommend permissions be set to the following:

wp-admin: 744

wp-content: 744

wp-content/themes: 744

wp-content/plugins: 744

wp-content/uploads: 744

wp-config.php: 764

.htaccess: 764

To check and set the file permissions, you can use cPanel > File Manager in your web hosting account. Once the correct permissions are set, you should have access to the WordPress login page.

  9. Reinstall WordPress

If you still don’t have access to your WordPress admin, you can reinstall WordPress. There’s a possibility that files in the WordPress core installation are corrupted. Reinstalling WordPress is a big step, as you’ll be replacing core files. But there are ways to do this without any stress.

CAUTION: This step carries a certain amount of risk. We recommend taking a backup of your site and using a staging site to reinstall WordPress.

  10. Increase Your PHP Memory Limit

Every website is granted a limited amount of PHP memory. If you exceed the limit, errors can start popping up on your site. Increasing the PHP limit can resolve these errors. To do this, you need to edit your wp-config.php file.

Log into cPanel > File Manager > public_html. Right-click and edit this file.

To edit the memory limit, find this line of code:

define(‘WP_MEMORY_LIMIT’, ’32M’);

Increase the limit from 32M to 128M using the following line of code:

define(‘WP_MEMORY_LIMIT’, ‘128M’);

Save and exit the file.

  What To Do If You Still Can’t Access wp-admin

If you’re still locked out of your WordPress admin, here’s what you can do: Contact your web host – Your web host will look into the issue and reset your login access. Contact the customer support of your web host and ask them for assistance. Ask for help on the WordPress Support Forum – WordPress has an active Support Forum where you can ask for help from fellow WordPress users. You can post details about the issue you’re facing and someone will help you figure it out. Check popular forums – There are a number of forums where WordPress users are active. You can seek answers on Reddit, Quora, StackExchange, and StackOverflow.

Source:

Leave your thought here

Your email address will not be published.

seventeen − sixteen =