Encountering the “sorry you are not allowed to access this page” error on your WordPress website? 🤔
“Sorry you are not allowed to access this page” is a common WordPress error that appears when you are trying to access a restricted page in your WordPress dashboard.
The restricted page could be a post, setting, menu, or even the main dashboard page in some instances.
Not having access to the dashboard is alarming, but there’s no need to panic. With a little effort, you can remove the error and get back to managing your website in no time.
All you need to do is try out the solutions we have listed below in this article. 😎
Let’s get started.
What is the “Sorry you are not allowed to access this page” error? And why does it occur? 🧐
As the name suggests, the “sorry you are not allowed to access this page” error appears on a WordPress site when you are trying to access a page that you don’t have permission to see (or that WordPress doesn’t think you should be allowed to see, possibly because of a misconfiguration).
Sometimes, this is intended behavior because WordPress intentionally limits what users with different roles can do.
👉 For example, if your WordPress account has the Author role, you wouldn’t be able to access the interfaces to install plugins or themes.
This is intentional behavior, in which case the “sorry you are not allowed to access this page” message isn’t really an error. You might need to contact the site administrator to ask them to upgrade your account if you think you should be able to access these areas.
However, this problem can become an error if you’re seeing this message when trying to access dashboard areas that you should have access to.
👉 For example, if you’re seeing this message as the site Administrator, that’s a pretty good sign that something has gone wrong.
The error sometimes appears after you have updated a plugin, theme, or WordPress core. That’s because the data stored in the plugin, theme, or WordPress core does not correspond with the data stored in the database of your site.
Think of it this way: You may be assigned as an admin in the database, but the software you just updated looks upon you as a subscriber and prevents you from accessing its settings page. That’s when you see the “sorry you are not allowed to access this page” error on your site.
Other possible causes include running outdated PHP versions, file permissions problems, incorrect credentials in your wp-config.php file, and more.
No matter why the error appeared, you can remove it from your site by taking the steps in the next section. 👇
How to fix the “Sorry you are not allowed to access this page” error 🔧
Fixing the “sorry you are not allowed to access this page” error is time-consuming because a number of reasons could have led to the error. You might need to try many solutions before you find the root of the problem.
But first, make sure you have a backup of your entire website. Executing some of the solutions in this tutorial could lead to further damage. If that happens, a backup will act as your safety net. You can quickly restore your website and continue trying the solutions.
IMPORTANT: Speaking of backups, if you take daily backups, then try restoring the latest backup of your site. It will often remove the error and you can get back to managing your website in no time. The only drawback here is that you stand to lose any work you did on your website between taking the last backup and the appearance of the error.
Now, let’s get started.
- Refresh website
- Try different browser & clear cache
- Set proper user roles
- Disable plugins & themes
- Ensure database prefix is correct
- Fix file permissions
- Upgrade to the latest PHP version
- Regenerate .htaccess file
1. Refresh website
The error might have been caused by a temporary issue that took care of itself. Refreshing the website could allow you to access the page. But make sure to wait for 2-3 minutes before you refresh the page.
2. Try different browser & clear cache
You can also try opening the URL on a different browser like Safari, Firefox, Opera Mini, Microsoft Edge, etc. If the site successfully opens in a different browser, then your current browser is showing you a cached version of the website. In that case, to remove the error from your site all you need to do is clear the cache. Here’s a guide that’ll help you do just that.
3. Set proper user roles
The error could be occurring because your user roles have been inadvertently changed. Since the “sorry you are not allowed to access this page” error blocks you from accessing the dashboard, you can ask other admins to set your user roles properly.
If you or someone else still has access to the dashboard, you can change a user’s role by editing their profile in the Users area of your dashboard.
Alternatively, you can create a new admin user via phpMyAdmin and gain access to the site.
The phpMyAdmin is the database of your website. It stores a ton of information, including your user roles. You can access phpMyAdmin to check if your user roles have been changed.
4. Disable plugins & themes
If the error occurred after you added or updated a theme or a plugin to your WordPress website, then perhaps the theme or the plugin is the culprit. Try disabling the software.
If you can’t access the Plugins and Themes list in your dashboard to disable the extension from the dashboard, you can also manually disable plugins and themes using FTP or cPanel File Manager.
Open your hosting account and go to cPanel → File Manager → public_html → wp-content. You should see a themes and plugins folder.
If you want to disable a theme, then go to the themes folder, select the theme, right-click, and then select Rename. Rename the theme into something else. Then check your website.
In the same way, disable the plugin you had installed or updated before the error appeared on your site.
You can also try disabling all your plugins at once and checking if the error is gone. If that fixes it, you can reactivate your plugins one by one until you find the problematic plugin.
5. Ensure database prefix is correct
Migration from a different hosting server or a local server can also lead to the “sorry you are not allowed to access this page” error.
Migration causes discrepancies in your wp-config.php file. The most common discrepancy is the change of database prefix.
To fix it, you need to access the wp-config.php file, check the prefix and then match it with the prefix listed on your database. We will show you how to do that.
Step 1: Check wp-config
Open your hosting account and go to cPanel → File Manager → public_html.
You should find the wp-config.php file in the public_html folder. To open the file, right-click on the file and select View.
Next, you will see your database prefix looking something like this: $table_prefix = ‘wpcg_’;
This means that the config file believes that the prefix of our database is wpcg_. Now we need to access our database and check if the prefix there matches with the one in the config file.
NOTE: The default database prefix on a WordPress website is ‘wp_’ We had to change the prefix on our demo site due to security reasons.
Step 2: Check database
Open your hosting account and launch phpMyAdmin, which you can do from cPanel if your host offers it.
On the left side of the phpMyAdmin page, you should find a database option that you can expand. Expanding the database will reveal the prefix.
If it matches with the prefix in the config file then your database prefix is not causing the error.
If it doesn’t match, then you need to edit the wp-config.php file and change the database prefix.
All you need to do is open the wp-config.php file by right-clicking on the file and selecting Edit. Then, scroll down to the database prefix and change it. Don’t forget to hit the Save button before you exit.
Check your website to see if the “sorry you are not allowed to access this page” error is gone.
6. Fix file permissions
In some cases, website users come across the error when the file permissions of the site have been tampered with. We suggest fixing the file permission immediately.
For a detailed look, you can read our full guide to WordPress file permissions. Here’s the quick version…
You will need to install an FTP client like FileZilla and then connect your website with the client. This guide will help you do just that.
After the connection has been established, you should see a public_html folder on FileZilla.
In the public_html folder, you will find these folders: wp-admin, wp-content, and wp-includes. Select all three folders, right-click and click on the Change Permission option.
Set the permission as 755. And select the Recurse into subdirectories and Apply to directories only option. Hit the OK button to save your settings.
Next, select all the files and set the file permission to 644, then select the Recurse into subdirectories and the Apply to files only option. Save your settings and close FileZilla.
Then check if the error is gone from your website.
IMPORTANT: If changed file permission was the cause of the error, then it’s possible that your website is hacked and the file permissions were tampered with by hackers. Scan your website immediately with the help of a WordPress security plugin.
7. Upgrade to the latest PHP version
An outdated PHP version can also be a reason why you are seeing the error on your WordPress site. The process of updating PHP differs from hosting to hosting. We have a guide on how to update PHP on your WordPress site. Take a look.
If your website is hosted with a hosting provider, we didn’t cover in the article, then reach out to your provider and seek help.
8. Regenerate .htaccess file
Still seeing the error? Then perhaps your .htaccess file is corrupt.
Go to your hosting account and open cPanel → File Manager → public_html → .htaccess. Right-click on the file and select Edit.
Next, replace the content of the file with the following text:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %REQUEST_FILENAME !-f RewriteCond %REQUEST_FILENAME !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Save the file and check if the error has been removed from the site.
That’s it! 🤩 We hope by now you were able to fix the “sorry you are not allowed to access this page” error on your WordPress website. If not, then reach out to your hosting provider and seek help.
Fix the “Sorry you are not allowed to access this page” error for good 🏁
Fixing the “sorry you are not allowed to access this page” error is not difficult but time-consuming work. It can be hard to pinpoint the exact cause behind the error, which is why you need to try every solution to find the right one.
To avoid issues, make sure to take a backup of your website before carrying out any of the solutions.
If you have any questions about the “sorry you are not allowed to access this page” error, leave a comment below.