You sometimes get annoyed with errors happening to your WordPress site while working on it. You can see a notice of internal server error or the entire site turns white immediately.
Have you ever come across a message saying “Sorry, you are not allowed to access this page”? This means that you’re blocked from the WordPress admin. Consequently, you’re unable to make any important changes on your site, especially from the backend.
What are the reasons behind this issue? How to resolve it quickly? We’ll help you answer these questions in this post.
What Causes Access Denied Issue in WordPress?
WordPress shows up the line “Sorry, you are not allowed to access this page” for numerous reasons. As a matter of fact, this message serves security purposes. It prevents unauthorized users from accessing certain areas of your admin dashboard.
Using an outdated PHP version can be one of the causes of this issue. You have no other choice but to upgrade to the lasted version of PHP to avoid it.
Another reason comes from the mismatch between your information (username and password) and your wp-config.php file. Consequently, the system blocks you from accessing some places in the admin dashboard.
Last but not least, your role doesn’t have permission to that area. For example, editors should change things on the “Pages,” “Posts,” or “Media” sections only. They will see this error when attempting to open the “Plugins” or “Themes” page which is available to admins only.
Since we’ve gone through the root causes of the access denied problem in WordPress, let’s look at 5 ways to resolve it together.
How to Fix “Sorry you are not allowed to access this page” WordPress
#1 Revert Your Site to the Previous Version
As mentioned, a minor update on your WordPress site will lead to the block of your access in the admin dashboard. Restoring the website version proves the simplest solution. This way will disable the current change and go back to the pre-error state.
Depending on your hosting that you’re enabled to restore your WP version differently. Kinsta allows you to back up your hosting account by logging into your Kinsta dashboard → Sites → choosing your desired site file → Backups → deciding the timeline you plan to restore its version → hitting the Back up now button.
It’s recommended to back up your site to the Staging status otherwise you’ll lose all the changes you’ve made.
In case you’re using Hostinger’s hosting service, after logging in to your control panel, you can make a backup by going to Files → Backups.
#2 Check Plugin and Theme Conflicts
A newly added plugin can force your site to display the message of “Sorry, you are not allowed to access this page.” In case you deactivate all plugins and still see this notice, then they’re not the reason.
If the message has gone away after your plugins go inactive, then you need to activate them again one by one to see which plugin raises the issue.
You can’t do this in your admin dashboard since you don’t have its access now. Instead, you must log in to the server, then open the wp-content file. The next step is to find the sub-directory called plugins.
You start with the newly-installed plugins. The process is to deactivate that plugin, then go back to your site and see if the message is removed. Repeat the process with the next plugins until you find which one creates the problem. Once finding out, simply deactivate again and remove it from your site.
The same thing goes for your theme. You can navigate to the wp-content file in your server and choose themes. All you need to do now is deactivate this theme and enable the default theme, such as the Twenty Twenty or Twenty Twenty-One.
The drawback of this method is time-consuming. You have to go through every plugin until knowing the right cause.
#3 Check Your File Permissions
WordPress still doesn’t let you access a few areas on your site even though you’re the admin due to the site’s file permissions.
If you’re using the FTP client, here are the correct WordPress permission modes to refer to:
- Folders – 755
- Files – 644
- wp-config.php – 600
- .htaccess – 644, or 600
You can refer to this article on how to fix WordPress file and folder permission errors on your site.
#4 Update Your WordPress .htaccess File
If none of the listed methods can help you solve the access denied mistake, try resetting or creating a new .htaccess file. To achieve that, connect to your FTP client and navigate the public_html folder which contains your .htaccess file.
You should right-click and rename that file to htaccess_backup or htaccess_original before making any changes. After that, you download the file to your computer.
You now open that file in the TextEdit or Notepad text editor and replace the current code snippet in the file with the following one.
#BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCOnd %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] #END WordPress
Once changing this file name to .htaccess again, you reupload it to your server. If you have a problem with the .htaccess file and the site appears that message, it should be fixed now.
#5 Get a List of Errors from Using Your wp-config.php File
Using the WP_DEBUG tool is one of the effective ways to figure out the WordPress site’s access denied issue.
All you need to do include inserting this code snippet into the wp-config.php file. If you already have one, you don’t need to add another.
define( 'WP_DEBUG', true );
The DEBUG tool now will go through every page on your WordPress site to double-check where the problem comes from. Then, it’ll list out all the mistakes in the wp-contents/debug.log for you to see and fix.
No Longer Access Denied Issue in WordPress
No matter what causes the message of “Sorry, you are not allowed to access this page.” in WordPress, it always frustrates you, as the site owner. You’re unable to access or take any actions on certain areas on your site.
We’ve shown you 5 ways to fix this, including restoring your WordPress site versions to checking plugin/theme conflicts. You can also look at your file permissions to see if it’s set correctly. Another way to solve this problem is using the DEBUG tool to get a list of issues. If all these solutions don’t work, we suggest creating a new .htaccess file.
If you apply and one of these methods helps eliminate the problem, don’t forget to share with us your experience.