WordPress 401 Error: How to Fix the 401 Error in WordPress (Easy Solutions)


WordPress has several types of errors and every error has its own solution. One of the most frustrating error is the 401- Unauthorized Error.

A 401 unauthorized error in WordPress means that you are trying to view a particular page or post that you don’t have authentication to access it.

In simple words, WordPress 401 Error means that access is denied due to invalid credentials or proper authorization is required.

So in this article, I will show you different ways and easy solutions that you can use to fix the 401 Error in WordPress. If you are facing any WordPress errors, then check the Complete Guide to WordPress Errors and Solutions.

401 error in WordPress

Disclosure: I may receive affiliate compensation for some of the links below at no cost to you if you decide to purchase a paid plan. You can read our affiliate disclosure in our privacy policy.

What is 401 Error in WordPress means?

A 401 unauthorized error is an HTTP code that presents that the server received a request and that request is unauthorized.

This error is mostly generated due to invalid credentials or because the browser didn’t understand how to supply the credentials.

During this error, the browser isn’t able to authorize itself with the server and thus throws an error that it received in the WWW-authenticate header, stating it’s unable to view the resources.

Mostly the 401 error happens in a WordPress admin and login pages and in very rare cases it may appear on your entire website.

Difference between 401 and 403 Error

401 and 403 Error are very similar but both are different. Here is what you should know.

401 Error: You are unauthorized to access it as you have provided the wrong credentials or there’s a problem authenticating the access for you.

403 Error: Means access is forbidden and you cannot access the resource or the page.

What Causes the 401 Error in WordPress

As said earlier, this problem is caused due to unauthorized requests or invalid credentials. The error can be solved in WordPress using the following methods.

Fix the 401 Error in WordPress
  1. Remove Password Protection
  2. Check the URL for error
  3. Clear Caches & Cookies
  4. Deactivate all Plugins
  5. Change to Default Theme
  6. Flush your DNS
  7. Reset WordPress Password
  8. Contact WordPress Hosting Provider.

How To Fix the 401 Error in WordPress

1. Remove Password Protection

If you have password-protected your WordPress folders or files then the 401 error will appear. Now, if you don’t remember which folder or files have your password-protected, then all you need to do is to follow this is a simple fix.

Login to your Hosting Panel and search for Directory privacy or Password Protected directories. This will help you identify the password-protected directories easily. So all you need to do is to remove the password from the directories and the problem is fixed.

If you don’t have this function in your hosting panel then you need to login to your hosting panel and access the Files Manager. Navigate to the root folder of your WordPress. Check the File’s permission for the files and folders.

If you find that a folder or a file is password protected, then simply untick the password-protected checkbox and save it.

You have successfully disabled the password protection for your WordPress admin, now try to login to your WordPress.

Note: 401 errors in WordPress are mostly seen in the WordPress admin or login pages.

2. Check the URL

If you have changed the url of any resource or page and you trying to access the page using the old url. You may encounter with the 401 error.

Since the old URL is no longer available and the resource doesn’t exist through the old URL, the browser might show a 401 error.

So check the url and try accessing the page using the new url. This time the 401 error should be gone.

If you are still facing the problem then go to WP-Admin > Settings > Permalink and click on the save changes button twice. This will rewrite your .htaccess files.

If you can’t access the WordPress admin due to the 401 error then login to your hosting panel and access the Files manager. From the file manager, navigate to the root of the WordPress root folder and edit the .htaccess file.

Delete everything inside the .htaccess file and paste this code and click on the Save Changes.

# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

3. Clear Cache & Cookies

Whenever you browse any website, the browser save the files and resources so that you can browse the website without waiting for the files to load.

This feature is called Cache. All browsers utilize this feature and Chrome does the most. Moreover, WordPress also uses caching features that with help of plugins. Sometimes the caches are outdated and overlap the current live version of the website, resulting in an error

By clearing the cache, you manually deleted all the old cache and request the website for the current live version. This fixes the 401 WordPress error in most cases.

Cookies are a piece of data that holds your authorization like your log-in sessions and other credentials. This may turn into invalid or ger corrupted for some reason and cause you a 401 unauthorized error.

Clear the cookies and close the browser and reopen the website.

If you are using Cloudflare or another caching plugin, then hit the purge cache button to empty the current cache and reload the live version.


4. Deactivate WordPress Plugins

WordPress functionality totally changes with the use of the plugin. WordPress has several security plugins that may lock the WordPress admin and login pages if your IP has a spam history or the plugin thinks that you are spamming or a security threat.

Then the plugin may block your access to the admin pages and you may encounter a 401 error. This happens because your plugins think that the site is under attack and locks the user out to protect it.


Sometimes a firewall can also trigger this 401 error in wordpress.

In this case, you need to deactivate the plugin if you know which plugin is causing this error. If you don’t know which plugin is causing this error, then deactivate all the plugins and only activate the necessary ones and after that contact the plugin support to resolve this issue.

To find the plugin that is causing this error, try activating the plugins one by one.

Note: Guide to Deactivate all WordPress Plugins without WP-Admin.

To better protect your WordPress site and its data from hackers and attacks, use the iThemes Security Plugin

5. Switch to Default Theme

Sometimes WordPress themes can also trigger the WordPress 401 unauthorized. Since WordPress Themes uses several php functions and methods and WordPress always uses the most stable and the latest version of PHP.

If your hosting accounts PHP version is outdated or doesn’t stand to the requirements of the WordPress themes, then the functions will not work as it supposed to be and the WordPress may show a 401 error.

The simplest way to fix this 401 error in WordPress, in this case, is to switch to the default WordPress theme.


The default WordPress themes come pre-installed in every WordPress, and in case if you have deleted it. You can download the latest version of the theme from the WordPress Repository. The default theme name is “twenty-Followed by the Year”. E.g: TwenyTwentyOne.

To change the WordPress theme from the WordPress Admin, navigate to wp-admin » Appearance » Themes » add new » upload. Upload the .zip file of the theme and activate it.

In case you can’t get access to the WP-Admin, you need to upload the theme folder to the WordPress Theme directory using FTP. Upload the themes folder “twentytwentyone” to WP-content » themes.

6. Flush your DNS

Sometimes DNS can get messed up too. This happens in rare cases too.

Fixing the DNS errors is very easy and its worth to give it a shot as sometimes as simple as this can cause the WordPress 401 Error.

To flush the DNS, you need to follow the exact steps.

For Windows users

  1. Open search window.
  2. Type “CMD” in search field and then right click on it.
  3. Choose Open as Administrator.
  4. After the command prompt opens, type the following and hit enter.
  5. ipconfig/flushdns

For Mac Users

  1. Open Spotlight and search terminal or Choose the terminal from the Applications » Utility folder.
  2. Enter the code below and hit enter.
  3. sudo killall -HUP mDNSResponder

7. Reset WordPress Password

Sometimes WordPress hosting companies blocks the access to the WP-Admin and login pages if someone repeatedly fails to login and tries to enter password.

The companies do this to protect the user’s site from attackers. In this case, you will be temporarily blocked and you can retry after some minutes or from different device with different IP.

But the best thing to do is to reset the password, instead of guessing the password and blocking yourself again and again.


To reset the password. go to your wp-login.php page and select the “lost your password”. Fill in your username or the email and hit the reset button.

WordPress will send you an email with a link to change your password. Type in your new password and get access to your site again.

We have remembering passwords and especially when you have a lot of sites to visit. That’s why we use 1Password to manage our passwords and the best feature is that it automatically generates strong passwords that are non-hackable and auto-fills the password when you visit the website.

8. Contact WordPress Hosting Provider

If you have tried all of the above methods and still can get access to your site and the site is stuck at the 401 Error.

Then it’s better to get in touch with your hosting provider and they can help you get your site back to work.

WordPress hosting companies use security measures to block out the attackers and spammers from their servers as it hurts their reputation and the goodwill of the brand.

For future protection of your WordPress site, you can follow our WordPress security Guide and our WordPress Errors & Solutions Guide to get rid of the 401 Error in WordPress and other errors also.

You can also hire a WordPress Agency to fix your problem. They will monitor your site and fix all the possible errors and bugs. You can contact GloriousThemes.com for WordPress-related services.

Fix 401 Error in WordPress

That’s all.

However, your needs may be different from mine. Which plugin is your favorite, and are you currently using it on your site? Do you have any other recommendations to add? Please voice your thoughts in the comments below!

You can also subscribe to our YouTube and Like and Follow us on FacebookTwitter, and Instagram.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *