How to Fix a WordPress Site With a 401 Error (5 Solutions)

So What is a 401 Error, Exactly?

The 101 on 401

Simply put, a 401 error is what happens when communication with the WordPress hosting server is attempted without proper authentication.

This error can appear in a number of different forms. The most common error messages are “Error 401” and “401 unauthorized error”. These two numerically-based errors are usually accompanied with the message “Access is denied due to invalid credentials” or “Authorization required.”

401 Unauthorized Error
~ 401 unauthorized error.

One of the most frequent causes of a 401 error is simply forgetting to enter a password when you try to access your account. But there can be more to it than that. If there’s an attack on your site, any WordPress security plugins that you use may lock down your admin area. Which will, in turn, cause a 401 error message.

Another possibility is that your hosting company may display the error when your login pages are accessed excessively or brute-forced. Normally, these messages will appear on your admin page and login page. However, the error may appear throughout your site, especially if it’s more serious.

Now that you know the basics about the error and its causes, let’s run through the various fixes. Most of these are simple, but some require more complicated procedures.

Table of Contents

  1. Disable Password Protection
  2. Clear Your Firewall Cache
  3. Deactivate Your WordPress PlugIns
  4. Switch to a Default WordPress Theme
  5. Contact Your Web Hosting Provider

Solution 1: Disable Password Protection

One of the quickest and easiest fixes for a 401 error is to temporarily remove password protection on your admin page (if you have it enabled).

To do this, you’ll need to log in to your control panel (cPanel, Plesk etc.). Then, look for the icon Directory Privacy or Password Protected Directories.

Directory Privacy Icon
~ Find the Directory Privacy icon.

When you open one of these icons, you’ll see all the files and folders on your hosting account. Find the wp-admin directory and click the name to select it.

Directory Privacy Folders
~ Find the wp-admin folder and click the name.

When you do this, your control panel will display the password protection settings. If the box is checked next to “Password protect this directory,” uncheck it and click the Save button.

Password Protected Directory
~ Uncheck the box next to “Password protect this directory.”

Once you’ve done that, scroll down and delete the username as well. Try to log in again. If you’re successful, you can create a new username and password for the directory and proceed normally.

Solution 2: Clear Your Firewall Cache

If you’re using a cloud-based WordPress firewall service like Sucuri, the 401 error may be triggered when the firewall fails in its efforts to communicate with your WordPress site.

The basic solution for this is to go to the dashboard of the firewall and find the section pertaining to cache functions.

Clear Cache Sucuri
~ An example of how to clear Sucuri firewall cache.

This will be slightly different for each firewall plugin, but that’s the basic solution, and a simple implementation will often allow you to proceed unimpeded.

Solution 3: Deactivate Your WordPress PlugIns

If a WordPress plugin is configured incorrectly or isn’t working right, this too can cause a 401 error.

To fix it, visit the plugin page Plugins > Installed Plugins and deactivate all of your plugins. This will allow you to reactivate them one by one to determine which plugin is causing the problem.

Deactivate Plugins
~ Deactivate all plugins and reactivate one by one.

If you don’t have access to the WordPress dashboard, you’ll need to use a File Transfer Protocol (FTP) like FileZilla to deactivate the plugins.

This can be done by going to the WordPress plugin folder wp-content/plugins and renaming it, designating it to be plugins-deactivated.

Deactivate All Plugins
~ Deactivate all plugins by renaming the folder.

Once the plugins are deactivated, you can return to the admin area and try to log in. If you are successful, switch back to FTP access.

Rename the plugin folder so that the plugins are activated again, then go back to the admin area and deactivate them one at a time to see which one is causing the problem.

When you’ve isolated the problematic plugin, you can either try to get support from the plugin creator or find another option.

Solution 4: Switch to a Default WordPress Theme

If you’re using your own WordPress Theme, this can sometimes be the cause of a 401 error. To fix it, you need to temporarily switch to a default WordPress theme.

These themes are supplied by the WordPress, and they’re shipped as part of the default version that’s automatically installed if you don’t designate otherwise.

To do the switch, go to the Appearance > Themes page and try to deactivate your own theme. Then, switch to one of the default ones. (e.g. 2020, 2019, 2018, etc.).

Activate Default WordPress Theme
~ Activate a default WordPress theme.

If the error goes away once you’ve activated the default theme, that means your theme was the issue, and you either need to contact the theme developer to fix it or permanently change to a different theme.

Solution 5: Contact Your Web Hosting Provider

In some instances, the 401 error can be generated when your hosting provider detects suspicious activity. Usually, this security precaution only affects the admin area of WordPress and makes your login page inaccessible for a brief but indeterminate period of time.

After waiting, the page should return to normal. If it doesn’t or you start seeing 401 errors on all your site pages, contact your hosting provider immediately. They can help address the issue and fix the problem.

My Final Thoughts

When it comes to WordPress, most errors are easy to understand, and correcting them is generally simple as well. But there are exceptions. The 401 error is definitely one of the more confusing ones and fixing it can be tricky business.

I think the important thing to remember is that 401 errors are caused by improper authentication. If you keep this in mind when you are trying to troubleshoot your website, it will help lead you in the right direction.

If you enjoyed this tutorial, please be sure to follow us on Facebook and Twitter. You can also find us on Freelancer if you need some help with your WordPress website or web development issues.

More Great Tutorials

David Green

My name is David and I am the founder and author of Zuziko. I am passionate about web development and have created Zuziko as a way to share my knowledge and experience with the world.

Leave a Comment

Share via
Copy link
Powered by Social Snap