Did you receive the “Sorry, you are not allowed to access this page” error message and can’t solve the problem? Don’t worry, since we will provide nearly a dozen solutions. For now, we urge you to begin troubleshooting as soon as possible. Keeping a public page inaccessible for long can hurt your search engine rankings. If reserved for user roles such as administrators, editors, authors, and so on, the unavailability of the page can halt the work and have negative consequences. Luckily, we can show you how to fix the “Sorry, you are not allowed to access this page” error in WordPress.
1. Restore data from a WordPress backup
The fastest and safest method to solve the problem with the “Sorry, you are not allowed to access this page” error is to go back to a working version, i.e., a recent backup. A responsible website owner has scheduled backups, meaning they have multiple versions to pick from. Reverting the site to the pre-error state removes the need to troubleshoot. It also makes it much easier to note the actions that make the error appear, if any do.
If you’re using plugins that permit you to update and roll back updates to your site, even better. In contrast, if you weren’t as diligent with security, check whether your web hosting provider periodically stores automatic backups. Many (e.g., Kinsta, and Hostinger) save the state of your website and database frequently.
2. Examine file and folder permissions for the WordPress website
As the error message suggests, access to the page is blocked. A common reason for the blockage is insufficient permission for website files. Luckily, we already demonstrated how to fix errors with file and folder permissions. In short, you access your website via FTP (and don’t quit—nearly all methods below require it), then select all data inside and set 755 for directories/folders and 644 for the files. That will ensure you have the necessary access, hopefully fixing the discrepancy between what the browser shows and the files in the database.
3. Enable WP error logging and check the logs
It feels a bit silly to say, but a single comma, dot, bracket, or quotation mark can wreak havoc in PHP, CSS, and HTML, and make a page or all related pages produce an error. Unsurprisingly, finding the problematic character, plugin, theme, code snippet, or whatever is responsible is the hard part. Thankfully, our guides on debugging WordPress and checking WordPress error logs provide all the necessary information. Enabling the WP_DEBUG
boolean will print error logs, and usually give you a location down to the file, line, and problematic character(s). Double-check that you print logs in a private log file. Errors on the front end are ugly to see and risk your privacy and security.
4. Double-check user roles for a WordPress site or sites
We know it may sound unusual, but you should check whether you or the person whose access is restricted, is still whichever role they are supposed to be. If you installed security or user-related plugins recently or switched to a WordPress Multisite network, the user roles may be a tad wrong. The first step involves accessing the WordPress Admin Section, then going to Members → Roles or Users → Roles, and clicking on Edit below the role’s name. Another, less beginner-friendly method, is to access your database via cPanel, and check like this:
- Find and select phpMyAdmin under “Databases”.
- Expand the main folder for your database on the left/hand side, and click the wp_users table.
- Find the name of the desired user and remember the corresponding number in the “ID” column.
- Switch to the wp_usermeta table on the left-hand side, then find the wp_capabilities row for the fitting “user_id”.
- Double-check that the permissions in the “meta_value” are
a:1:{s:13:"administrator";s:1:"1";}
. - You can now edit the value for the existing account with the Edit link on the far left. Alternatively, create a user for testing in the table from step 2, then add the aforementioned permissions with steps 4 and 5.
5. Look for any changes to wp-config.php
By now, you realize that the fix for the “Sorry, you are not allowed to access this page” WordPress error involves eradicating inconsistencies between web browser requests and its data and the data in the database. A good way to check is your WordPress configuration file, titled wp-config.php. It is inside the root folder of your website, and the first thing we’d check is the database prefix ($table_prefix = 'wp_';
is the default). If you noticed the tables having a different prefix in method 4, there’s your issue. Change wp_
to the one for the tables in the database.
6. Disable your WordPress plugins and themes
Go to your WordPress Admin dashboard and disable the last plugin you activated by going to Plugins → Installed Plugins and clicking Deactivate below their names. The same works with themes, which will revert your website to the default theme and reveal the culprit. Find the problem or another theme.
A faster way involves deactivating all plugins by going to root/wp-content/plugins
, and renaming the plugins folder to plugins.deactivate. Save changes and see if the error disappeared. If it did, rename plugin folders inside one by one until the error reappears. When it does, you found the concern. You can do the same with theme names inside wp-content/themes
. Don’t forget to reverse the change on unproblematic themes and plugins.
7. Temporarily reset the .htaccess file
A corrupt .htaccess file or one with an improper configuration can mess things up. We would save pinpointing codes inside for when you establish it is the root of the difficulty. Instead, make a copy of the .htaccess file in the root folder, and name it .htaccess-backup. Then, edit the original one and erase everything inside. Add the default .htaccess code instead:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Save changes and check if that was the cause of the “Sorry, you are not allowed to access this page” error in WordPress. If so, delete this file, make a copy of the original, and take time to go through codes to find the issue after renaming the original back to .htaccess.
8. Upgrade the PHP version for your WordPress website
A final potential cause of the problem is an outdated version of PHP that clashes with your WordPress version, and compatible themes and plugins. Thankfully, we already showed methods to update PHP in WordPress. That should get things up to speed and may remedy the issue.