How to Fix 401 Errors in WordPress
If you are getting the 401 error on WordPress then this post is for you. This is one of the most confusing errors that locks you out of your WordPress website. The error also has multiple names which include Error 401 and 401 unauthorized error. Often the error will be accompanied by the message, ‘Access is denied due to invalid credentials’ or ‘Authorization required’. There are several solutions you can use to fix this error.
What causes this error in WordPress?
The 401 Error on WordPress is caused by improper authentication when communicating with the hosting server. For example, if you password protected any of your WordPress admin folders and you did not enter the password you will get the 401 error page on the WordPress login and admin pages.
There are cases you will see the error even without having any special password protection on your WordPress website. WordPress security plugins, for example, can lock down the admin area in the event of a brute force attack. Security measures taken by hosting companies to protect the WordPress website may also trigger the error.
In most cases the 401 error appears on the WordPress admin and the login pages. It can also appear on all web pages in some cases. Troubleshooting can help identify the cause of the error. Here are some solutions you can use to fix the error.
Temporarily remove password protection on the WordPress admin
If you password-protected the WordPress admin directory the first thing you should do is remove it. Go to the WordPress hosting control panel and locate Directory Privacy or the Password Protected Directories icon. Go to the wp-admin directory and click on it. You will see all your passwords. Uncheck the box next to ‘Password protect this directory’ option and save. You also need to delete the username used to password-protect the directory. If this was the problem then you will have solve the 401 Error on WordPress.
Clear firewall cache
If the first step didn’t solve the error you need to clear the firewall cache. If you are using any cloud-based WordPress firewall service like Sucuri the error may be caused when the firewall doesn’t communicate with your website. Login to your firewall dashboard and go to ‘Performance’ page. Go to the ‘Clear Cache’ tab then click, ‘Clear cache’ button.
Deactivate all plugins
Poorly configured WordPress plugins or plugin misbehavior can cause the 401 error. Deactivating all plugins temporarily will help determine if the error is being cause by a plugin. If it is a plugin causing the error you have to deactivate all plugins and activate them one by one until you find the one triggering the error.
Other solutions you can consider include switching to the default WordPress theme, resetting your WordPress password and contact your WordPress hosting provider to see if the problem is on their end.