Are you getting a WordPress 401 error? This isn’t unique to WordPress. 401 errors are thrown at the server level. But, a WordPress plugin or setting can cause a 401 error, too. Fortunately, there’s several ways of getting your WordPress site back up and running.
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.
A 401 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.”
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 401 errors and their causes, let’s get to the various fixes. Most of these are simple, but some require more complicated procedures.
Table of Contents
- Disable Password Protection
- Clear Your Firewall Cache
- Deactivate Your WordPress PlugIns
- Switch to a Default WordPress Theme
- Contact Your Web Hosting Provider
5 Ways to Fix WordPress 401 Errors
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.
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.
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.
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.
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.
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.
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.).
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 on 401 errors and WordPress
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.