How to Fix “Sorry, you are not allowed to Access this Page” Error in WordPress?

How to Fix “Sorry, you are not allowed to Access this Page” Error in WordPress?

Unfortunately, when the error “Sorry, you are not allowed to Access this Page” occurs in the site. Then it is difficult to know what will be the main cause of this? Basically, this error appears as a result of security reason or permission issue.

Sorry You Are Not Allowed To Access This Page

There could be another reason like username and password in wp.config.php does not match with the database.

Also, in the case when the site has an outdated version of PHP and after updating, this error occurs. This happens because sometimes WordPress is not compatible with the new version of PHP.

Step 1) Reset all the Changes

Firstly, try to remember the last change you have done to your site. Now, if you are sure about what is the last change made to your site then the only solution is to revert it.

Remove the plugins, themes previously added. Besides that, restore the site from the last backup if you confident that backup was taken before the error occurred.

Step 2) Get a List of Errors

1. To know which PHP error is causing the issue.

2. Firstly, open the WP_DEBUG tool.

3. Go to the WordPress site folder.

4. Open /wp-config.php/ file and add this code as shown below:

define( 'WP_DEBUG', true );

After adding this you enable to see the error in wp-contents/debug.log.

Step 3) Check the Server Error Log

When you set WP-debug tool to find PHP error then it also necessary to check out your server’s error log. This process helps to find out the problem. Besides that also check unauthorized access to your site.

If hackers are enabled to access your site then they would able to change your authority to log in to your site and you get this error “Sorry, you are not allowed to access this page”.

Step 4) Check Plugin Security Notification

Most of the times the error you get is due to the hackers attack on your site. So use WordPress security plugins on the site to find out the problem. These plugins send you a notification by the email alerts when such an activity happens.

Limit Attempts Booster is a one of such plugin which gives you an alert about the malicious attack by emails notifications.

Limit Attempt Booster Plugin

Email notifications by Limit Attempts Booster

Mail Notification of Limit Attempt Booster

Step 5) Check Your File Permissions by FTP client

1. To check file permissions, open FTP client. Enter your host details and navigate to public_html.

2. In the folder, highlight the subfolders named wp-admin, wp-content, and wp-includes. Select Change Permissions.

Change File Permissions

3. This will bring you to the page Change Permissions.

4. Under that check whether numerical value is 755 or not. Click Change Permissions Button to apply the changes.

Change Permission Numerical Value

5. Go back to public_html and select every file in it. But exclude the three directories which you already altered.

6. Then click on the right side of the files and again select change permissions. Now set numerical value as 644.

Change File Permission Numerical Value

To resolve the file permission error always set the Directory Permissions to 755 and the File Permission to be 644.

Step 6) Deactivate All Themes and Plugins

Now, deactivate one by one all the newly installed plugins and updated themes in your site. If you don’t have access of admin dashboard then deactivate these plugins and themes manually via FTP. Check whether the error occurs or not. If it still on the screen then there will be another issue.

Step 7) Reset Your .htaccess File

Moreover, if all the above method does not work then there will be some problem with the .htaccess file.

1. Go to a public_html folder using an FTP client. Right click on it, select Rename and change the name from .htaccess to .htaccess_backup.

2. Again Right Click on the file and Download it.

3. Open the file in the text editor and change the name back to .htaccess and replace the code with this.

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

4. Save the file and Upload back to your site. If there is a problem in this file then the error must be resolved.

Step 8) Upgrade PHP Latest Version.

When you are using an old version of PHP then this also be the cause of the error. So it’s the time to upgrade your PHP version.

Note: Always take back up of your database before upgrading the PHP.

Step 9) Database Prefix

After updating if you still find an error “Sorry, you are not allowed to access this page” then there is a problem with your database prefix. For this open wp-config.php file and also your database. Check (wp_ ) i.e WordPress default prefix for each table in the config file or in the local database.

Step 10) Export all Content and Import to Fresh WordPress

If all of the above methods cannot sort out the error then its time to reinstall your WordPress.

Download the wp-content folder, exports all content and import all data to fresh WordPress.

That’s all I hope this article helped you to know how to fix “Sorry, you are not allowed to Access this Page” error in WordPress?