Some WordPress users encounter an error on their website where it says, “Sorry, you are not allowed to access this page”. This is a very frustrating problem which can stop you from making changes to your site.
If you are facing this error on your site then there is no need to worry. Today, we will be discussing some methods which you can use to get rid of this error on your WordPress website. Let us begin.
What causes “Sorry, you are not allowed to access this page” Error
Someone can encounter this error while making changes to his/her WordPress site. The most common cause of this Error is a sort of security or permissions related issue. Another cause of this Error can be an outdated version of PHP. There can be many other causes also.
In order to cover all these causes, we will be sharing a total of 8 ways of fixing this error. All these methods are tested by us and they are working perfectly fine.
Revert your site to the Pre-Error site
This error might have occurred because of the changes that you made on the website. So, a simple way of fixing it is to revert that change. If you upgraded the site to a new version of WordPress, then try degrading it to the previous one.
If you installed a plugin/theme on your site recently then you should also consider deleting it because it might be that plugin or theme that is causing the problem. If you have a backup of your WordPress that was made before the error occurred then you should also consider restoring your site from that backup. You can look for the backups of WordPress by logging in to the cPanel.
Use WP_DEBUG to get a list of Errors
You can use the WP_DEBUG tool in order to get a list of Errors on your WordPress site. In order to activate this tool, just open your wp-config.php file and paste the following code there:-
define( 'WP_DEBUG', true );
Once you have done, the WP_DEBUG will be turned on and you will be able to view the list of the errors by going to the wp-contents/debug.log.
Review your Error Log
Now, you will have to check the server’s error log. Every hosting has its own method of displaying the Error log. The most common one is to use the .htsaccess file in order to review the error log.
After you get the list of Errors, try looking for the one that is likely to be the cause of the Error that you are facing.
Retrieve Plugin Security Notifications
An attack or hack can also be the reason for this Error. Most users always use some sort of a security plugin on their WordPress site. Such software notifies you whenever any suspicious activity takes place on your website. If you also have any such security plugin installed, open it and go to the inbox and spam folder. Look for the notification that was sent to you just before you encountered the Error.
You can also make use of any good security-based WordPress plugin for this. We personally recommend you to go for the WP Security Audit Log WordPress plugin. This plugin will allow you to keep track of WordPress core and settings. It can even help you to find out the root cause of this Error. You can install this plugin on your WordPress site simply going into the Add plugin option under the Plugins tab.
Deactivate all your Plugins and Themes
As we have discussed earlier, the plugins and themes that are installed on your site might be the reason that you are facing this error. So, deactivating all the plugins and themes that you have recently installed can also fix this problem. You will have to manually deactivate them using the FTP.
If the Error gets fixed after you disable all the plugins and themes, try activating each plugin and theme again, checking every time to see if the error comes again. By this method, you will be able to find out the plugin or theme that is causing the Error. You can then permanently remove that plugin or theme from your site.
Upgrade your Site’s PHP version to the latest one
An outdated PHP version can also be the reason for this Error. You should never use an older PHP version because it can reduce the speed of your site and it can also cause some security issues.
Firstly, you will have to check whether your site is compatible with the latest version of PHP or not. If yes, then create a local staging copy of your site. Once you have done that, you can upgrade the PHP version directly from the command line using the Virtual private server (VPS).
Check your Database Prefix
If you are unable to fix the error even after following the methods that we have listed above then you should check your Database Prefix because sometimes a little fault in the Database Prefix can also cause this problem. You can check your Database Prefix by opening up the wp-config.php file.
Reset your WordPress site
This is the last method that you should only consider if you are unable to fix the Error using any other method. Resettings your WordPress site will fix the error for sure but it will also delete all your posts and pages. You can take a backup of all your content and pages before resting the site so that you can restore all this data once the site gets reset.
This was a detailed tutorial of fixing the “Sorry, you are not allowed to access this page” Error. We hope that you resolved the Error by using any of the methods that we described. If you have any doubts related to any of the methods then you can leave them in the comments section.