Are you trying to fix the “sorry you are not allowed to access this page” error WordPress throws at you when accessing your admin dashboard?
This type of error can be frustrating because it does not provide visual feedback as to what is causing the error or any suggestions on how to resolve it.
Luckily, we have prepared a comprehensive guide with tested-and-verified methods on how to fix the “sorry you are not allowed to access this page” error in WordPress.
Before proceeding with the guide, it is crucial to understand the error properly and possible factors that may have led to the error page.
Meanwhile, if you’d rather not go through the stress of debugging the error by yourself, you can simply have one of our experts fix the error on your WordPress site.
- Causes of access this page error in WordPress
- How to fix “sorry you are not allowed to access this page” error in WordPress
- Undo Your Last Change
- Deactivate all plugins
- Restore a Backup
- Make sure you are the site administrator
- Check plugin security notifications
- Reset your htaccess file
- Check file permissions settings
- Update your PHP version
- Check your Database Prefix
- Turn on WP_DEBUG mode to view error logs
- Reset your WordPress website
Causes of Access this Page Error in WordPress
You might be wondering why you cannot access some pages on your website, even though you are the site administrator. Well, here are some reasons why it occurs on WordPress sites.
This error simply means there are some permissions required to access the page, that you currently do not have. If you are the admin, this could be happening for a number of reasons.
Firstly, it can occur if you recently updated your websites’ files, updated your plugins, or updated an outdated theme. If the data from the new file is not in sync with the database, WordPress might throw an error page.
Secondly, if the .htaccess file on your hosting server is corrupt, then you may encounter the error page on your WordPress site.
Also, using different table_prefix values on your database configuration can lead to this error. It occurs if the database prefix value in the wp-config file is different from the one you see when you access your database using PHPMyAdmin.
Lastly, the ‘sorry you are not allowed to access this page’ error can occur if you are using an outdated version of PHP on your host server.
How to Fix the “Sorry You Are Not Allowed to Access This Page” Error in WordPress
Before making any major change to your website, it is important to always back up your site files. That way, you can always revert the state of the website if anything goes wrong.
After backing up, proceed with the next steps to fix this error.
Undo Your Last Change
If you remember the last change you made on your WordPress site before seeing this error, an easy fix would be to restore your site to the pre-error state.
This could mean disabling a new plugin or theme you installed recently or reverting to an older WordPress version. If you cannot access your wp-admin, you can delete the theme or plugin via FTP or cPanel on your site server.
To do this, connect your website to an FTP client, such as FileZilla. Here’s a detailed guide on how to use FTP.
On the right, you would see your remote site files.
Here, locate the directory containing your WordPress site files and double click on it (this directory is usually public_html).
Within the directory, locate the wp-content folder and double click on it.
Next, double click on the themes subfolder and then locate the theme you want to disable.
Now, right-click on the theme you want to disable and then select the Rename option.
After that, append -disabled to the name of the theme.
Similarly, if you want to disable a plugin, on the wp-content directory, double click on the plugins folder.
Locate the plugin you want to disable. Then right-click on the folder and select the Rename option.
Now, append -disabled to the plugin name.
Now reload your site. If the new theme or plugin is the source of your error, it should work fine now.
Deactivate All Plugins
If deactivating a single recent plugin does not solve the issue, the problem could still be some other plugin. To test this, you would need to deactivate all plugins, and if that solves it, login to your WP admin and reactivate them one by one. Here’s how:
First, login to your hosting Cpanel or access your site files via an FTP client.
After that, navigate to the folder containing your site files, which is usually the public_html directory.
Next, double click on the wp-content folder to open it, and then locate the plugins folder.
When found, right-click on the plugins folder and select Rename.
Now, append _disabled to the plugin folder name.
At this point try accessing your site. If the issue is fixed, then one of your plugins was to blame. The next step is to locate the erring plugin. Here’s how:
Login to your WordPress admin panel and go to Plugins > All Plugins.
You will see that all your plugins have been turned off.
To get them back on the site, go back to FileZilla and rename the plugins folder to just “plugins”. Now come back to your plugins page in your WordPress admin and hit refresh. You would see all your plugins, but they would be deactivated.
Now activate them one after the other, until you see the error again. The plugin you activated before seeing the error is the cause of your issue.
Finally, repeat the steps to deactivate and reactivate all plugins (by renaming your plugins folder in FileZilla). Of course, do not activate the faulty plugin at this point. You may want to contact the plugin provider, or use an alternative plugin with similar functions.
Restore a Backup to Fix the “Sorry You Are Not Allowed to Access This Page” Error in WordPress
However, if you don’t use a backup plugin (which, you should), or you cannot access wp-admin, you may contact your host and have them restore your site to a recent backup.
If you have created local backups of your files and database, then you can restore those (if you don’t have local backups, simply skip to the next solution).
First the files. You can upload a backup of your site from your local machine using FTP. Here’s how:
First, connect to your site using an FTP client such as FileZilla.
On the left of FileZilla, navigate to the directory where you stored the site backup. On the right, FileZilla should be open to the folder containing your WP files (often public_html).
Now, select all the files and folders on the left and then right click and select Upload. To select all the files, simply hold Ctrl+A or cmd+A depending on your operating system.
After hitting upload, select the override option to replace the current files with the files you just uploaded.
When the file transfer completes, your site has been restored.
Next, you’ll have to delete your database and restore it from a previously saved database export.
How to Clear WordPress Database
Now, click on your website database and then click on operations.
After that, click on Drop the database option as seen in the image above.
To import a database backup, click on the Import Tab.
Next, click on choose file and then select the backed up database file from the folder you stored the backup.
After that, click on Go and wait for the database to be imported.
When the backup is restored, your site should work fine.
Make Sure you are the Site Administrator
A change you made on your WordPress site may have reverted your admin access on the site, hence preventing you from accessing the admin page.
To resolve this issue, login to the cPanel of your website (you can ask your Webhost for the login details if you don’t have them). Then click on the PHPMyAdmin tab.
You would see a list of databases on the left. Select the database of the site you are debugging, then click on the wp_users table.
Now, note the ID of the current admin user.
After that, click on wp_usermeta table then locate wp_capabilities for the noted user id.
Next, confirm that the meta_value column contains the code snippet below.
If you cannot find the value above, it means your admin access has been revoked.
To fix this, click on edit under the wp_capabilities row.
Now, add the code above to the meta_value column and then click on Go.
You should now be able to login if your issue was revoked access.
Check Plugin Security Notifications
If your site uses a WordPress plugin security (such as WordFence), a notification might have been sent to your email about an activity that led to the error.
However, if you did not get any email, or the log messages are not providing any useful detail on the cause of the error, the next thing you can try is resetting your htaccess file to default values.
Reset Your .htaccess File to Fix ‘Sorry You Are Not Allowed to Access This Page’ in WordPress
In some cases, the error can occur if the .htaccess file is corrupt due to a recent change in the website state. To fix this, you will need to create a new htaccess file and use the default values. Here’s how:
Connect to your WordPress site using FTP and then navigate to the directory containing your site files.
In the directory, locate the .htaccess file and double click on it to download a backup of the file on your computer.
Now, delete all the texts on the file, paste the code below, and save the file.
|# BEGIN WordPress
# END WordPress
After saving the file, FileZilla will prompt you to upload the updated file. Hit Yes to upload.
Now visit your site and try accessing the page showing the access error message. If the error disappears, hurray! We found the culprit.
However, if you are still seeing the error message after resetting the .htaccess file, check your file permissions settings next.
Check File Permissions Settings
Sometimes using the wrong file permission can result in the access error page. To check and update file permissions, access your site through an FTP client.
When connected, open the folder containing your WordPress site files.
Now, select all the folders in the directory (usually wp-content, wp-admin, and wp-includes). To select multiple files, hold the Ctrl or CMD key and then click on the folder you want to select.
Next, right-click on any of the selected folders and select file permissions.
In the ‘change file attributes’ popup window, ensure the Numerical value is 755.
Next, tick “Recurse into subdirectories” and then select “Apply to directories only”.
Click OK to apply these permissions.
Now, we will update the permissions for files. First, select all the files on your site directory (use ctrl+A to select all the files).
When selected, right-click on a file and select file permissions as seen above.
On the “Change file attributes” window, ensure the Numerical value is set to 644.
Next, tick “Recurse into subdirectories” and then select “Apply to files only”.
Click Ok to apply the new changes.
In summary, the numerical value for folders is 755 while that of files is 644. If any of the numerical values are different from the default value, it could be the reason for this error.
If you are still getting the same error page after updating the file permissions, then try updating your websites’ PHP version on your hosting account.
Update Your PHP Version
Using an outdated version of PHP sometimes affects the site performance and can result in the standard WordPress sorry, you are not allowed to access this page error.
To update your site PHP version, login to the control panel of your website. Depending on your hosting provider, the location of the settings can vary.
Firstly, click on Select PHP Version and then click on the current version.
A dropdown will appear showing all PHP versions available on your hosting server.
Select a recent version and click on Set as Current to save the changes.
It is a good idea to test the upgrade in a local staging version of your site to ascertain the compatibility before upgrading.
If you cannot locate the Select PHP Version settings on the cPanel of your site, you can contact your hosting providers for further guidance.
How to Fix ‘Sorry You Are Not Allowed to Access This Page’ in WordPress by Checking Your Database Prefix
Sometimes the slightest difference in the database prefix can lead to the access error page.
To resolve this, you need to make sure the prefix on the wp-config file matches the one on your database in PHPMyAdmin. Here’s what you need to do.
Start by accessing your site files via FTP.
Now, navigate to your WordPress sites’ directory, likely in the public_html folder.
After that, right-click on the wp-config file and select view/edit.
Locate table prefix variable, you can simply use ctrl+F or cmd+F to search. In the search field paste this line $table_prefix. Take note of the prefix on your config file.
Now, login to the dashboard of your cPanel.
After that, click on PHPMyAdmin under the Databases section.
Now, locate the database for the site you are troubleshooting.
Ensure the prefix matches the one in wp-config. If there is any difference between both values, it can be the reason you are seeing the access this page error screen.
To fix this, open the wp-config file and change the prefix value to match the one in PHPMyAdmin.
In some cases, changing the table prefix in wp-admin fixes the access error message.
Turn on WP_Debug to View Error Logs
This does not directly fix the error, but it provides visual feedback on errors occurring when you visit your website, which can help debug the error.
The settings can be found in the wp-config file on the server. To locate and edit the wp-config file, follow the steps below;
Connect to your site using FTP and then navigate to the folder containing your WordPress files.
Afterward, right-click on the wp-config file and select view/edit.
Next, select a text editor to view the file as we did below. Or even easier, simply select the 2nd option to open with your default editor such as Notepad.
After opening the file, use ctrl+F or cmd+F to open the search box.
Now, search for WP_DEBUG and then update the line to true.
You should have a command similar to the code snippet below.
|define( ‘WP_DEBUG’, true );|
Save the changes and when prompted to upload the updated file, hit Yes. Next, visit your website.
It will show a list of errors occurring when you try visiting the page with the error. These error log messages can help you identify the culprit and fix it accordingly.
Please read this guide to learn how to troubleshoot the error messages you see: How to Fix WordPress Syntax Error.
After troubleshooting your site in debug mode, revert the WP_DEBUG settings to false.
Reset Your WordPress Website
If none of the methods above fix the error message on your website. You can reset your website and clear all data. This is a last ditch effort when everything else has failed, which would indicate that there’s an issue with your WP install.
The steps below will only work if you can access parts of your WP dashboard. If you cannot access your WordPress admin dashboard because of this Error, you may reach out to our WordPress Experts to help you fix your website.
Before starting the reset process, you must export all your content (posts, pages, etc), so you can import them right back when done. To do this, go to Tools > Export on your dashboard and select ‘All Content’. Next click Download Export File. When the download completes, we can proceed with the site reset.
Using WP Reset Plugin to Reset WordPress
To reset your WordPress site, we will be using WP Reset Plugin.
Login to the admin dashboard of your website and then click on Plugins > Add New.
On the plugins page, type ‘wp reset’ into the search bar. Then install and activate the plugin.
Now, click on Tools > WP Reset to access the Reset plugin dashboard.
On the plugin dashboard, you will be shown all the data that will be deleted when you reset your website such as your posts, pages, users, comments, etc. Kindly go through the table for a list of files that will be deleted.
The plugin has an option to create a snapshot (backup) of your site, so you can undo the reset. Simply click on the Create Snapshot button at the bottom of the page.
After creating the snapshot, type the word ‘reset’ in the box and then hit the Reset Site button.
A confirmation window will pop up asking if you are sure you want to reset your site. Hit the Reset WordPress button to confirm the reset.
After resetting, you can upload your posts and pages by importing the file we exported at the beginning.
Conclusion – How to fix ‘sorry you are not allowed to access this page’ in WordPress
Sorry, you are not allowed to access this page error can sometimes be challenging to troubleshoot because of the number of causes that may lead to the access error message.
This guide has helped you understand the error as well as the common causes of the error. It has also given a variety of methods to help you troubleshoot and fix this error.
If you are still having challenges at this point, you may want to have a WP Expert resolve it for you.