Resolving the “Sorry, You Are Not Allowed to Access This Page” Error

Being greeted with the “Sorry, you are not allowed to access this page” error while trying to log into your WordPress admin dashboard can be quite a headache. This error is essentially WordPress’s way of saying there’s a permissions issue at play. But there’s a good chance you can tackle this problem head-on and regain control of your site.

Let’s break down what this error means, why it pops up, and the steps you can take to fix it.

Understanding the “Sorry, You Are Not Allowed to Access This Page” Error

First off, this message isn’t an error in the traditional sense but more of a security feature. It’s WordPress’s way of telling you that your current user role lacks the necessary permissions to access a particular page. Typically, this shouldn’t happen to an Administrator, who, by default, has access to all areas of the WordPress backend.

This issue might surface after updating WordPress itself, a theme, or a plugin. It could also be a sign of a mismatch between the information in your site’s database and what’s defined in your WordPress files, such as `wp-config.php`, or perhaps your site is running on an outdated version of PHP. Whatever the cause, this error restricts access to certain parts of your admin area, and fixing it often requires some work outside the WordPress dashboard, using tools like File Transfer Protocol (FTP) or phpMyAdmin.

How to fix the “Sorry, You Are Not Allowed to Access This Page” error in WordPress

Encountering the “Sorry, you are not allowed to access this page” error in WordPress can be a frustrating hurdle, derailing your workflow and access to your site’s backend. Fear not, though, as this guide walks you through 11 potential solutions to tackle this issue head-on, ensuring you’re well-equipped to regain access and get back to business as usual. So, let’s dive in and troubleshoot this together, shall we?

1. Restore a previous version of your site

Sometimes, the quickest fix is to roll back your site to a state before the issue began. This could mean undoing a recent update or change. If you’ve been diligent with your backups, restoring your site to an earlier version might just get you back in without any loss of data.

For those hosted on platforms like 10Web, this can be a breeze with one-click backup restorations.

  1. Log in to your dashboard.
  2. Click Manage on the website you want to restore.
  3. Click Backups in the left navigation.
  4. Select the Backup tab.
    Backups as displayed in 10Web's dashboard. You should make sure to have good backups ready if you're troubleshooting the Sorry, you are not allowed to access this page errror.
  5. Select a backup and choose Restore from its list of options.

However, tread carefully, as this means waving goodbye to any recent changes made. To mitigate this, consider restoring to a staging environment, allowing you to pinpoint and address the root cause without affecting your live site.

2. Disable all of your plugins

A troublesome plugin could be the culprit. You can identify if a plugin is at fault by disabling your plugins one by one (using an FTP client if you can’t access your dashboard). If the error disappears after deactivating a particular plugin, you’ve found your problem.

  1. Connect to your site via SFTP using a client like FileZilla.
  2. Navigate to `wp-content/plugins`.
  3. Rename the plugins folder to something like `plugins_old` to disable all plugins.
  4. Check your site. If the error is resolved, the issue was with a plugin.
  5. To find the problematic plugin, rename the folder back to `plugins` and then rename each plugin folder inside it, one by one, until you find the culprit.

3. Activate a default theme

Themes, much like plugins, can occasionally be at the heart of access issues, especially after recent updates or installations. Switching to a default WordPress theme (e.g., Twenty Twenty) via FTP can help determine if your theme is the issue. By renaming your current theme’s folder, WordPress defaults back to a pre-installed theme, potentially resolving the access error. This method also serves as a temporary fix, allowing you access to your dashboard to further investigate or replace the theme.

  1. Connect to your site using FTP.
  2. Go to `wp-content/themes`.
  3. Rename your current theme’s folder (e.g., `yourtheme_old`). WordPress will revert to a default theme.
  4. Check your site for the error. If resolved, the issue was with your theme.
  5. You can then troubleshoot your theme or choose to use a different one.

4. Make sure you’re an administrator

A change in user roles can inadvertently restrict access. Particularly in multisite installations, it’s possible to lose administrator privileges. Using phpMyAdmin to check the `wp_users` and `wp_usermeta` tables can reveal if your user role has changed. Adjusting the `wp_capabilities` value or creating a new administrator account directly in phpMyAdmin can restore your access, allowing you to rectify any role discrepancies from your WordPress dashboard.

  1. Access phpMyAdmin from your hosting dashboard.
  2. Find and click on the `wp_users` table.
    checking the wp_users table in phpmyadmin.
  3. Locate your user ID in the list.
  4. Go to the `wp_usermeta` table and search for your user ID with the meta_key `wp_capabilities`.
  5. If the value is not `a:1:{s:13:”administrator”;s:1:”1″;}`, use the edit link to change it to this exact string to restore admin access.
    Check the wp_usermeta to make sure the user has admin permissions to troubleshoot the Sorry, you are not allowed to access this page error.

5. Check your error log to pinpoint the cause

Consulting your server’s error log can offer clues to the underlying issue, whether it’s a plugin conflict, database error, or file issue. Platforms like 10Web provide easy access to these logs, enabling you to diagnose and address the specific cause of your access troubles.

The exact process may vary between different providers. For example, at 10Web:

  1. Log in to your dashboard.
  2. Click Manage on the website where you want to view the logs.
  3. Click on Hosting Services > Logs
  4. Select the Error.log or Access.log from the drop down menu.
    Selecting the error log from the drop down menu to check for issues related to the Sorry, you are not allowed to access this page error.
  5. Scan through the logs for any references to errors or problematic plugins or themes.

6. Ensure that your database prefix is correct

A mismatch between the database prefix in your `wp-config.php` file and your MySQL database can trigger access issues. This is particularly common following migrations. Checking and aligning prefixes can resolve the error, ensuring seamless database connectivity.

  1. Open your `wp-config.php` file via SFTP.
  2. Locate the `$table_prefix` line and note the prefix.
  3. Log into phpMyAdmin and compare the prefix with those on your database tables.
  4. If they don’t match, adjust your `wp-config.php` file to reflect the correct prefix.

7. Look for changes in your wp-config.php file

Modifications to your `wp-config.php` file, whether from recent edits or potential security breaches, can lead to access problems. Reviewing this file for any unusual changes and rectifying them can help regain access. Implementing file integrity monitoring can aid in spotting unauthorized changes swiftly.

  1. Access your site via SFTP and open `wp-config.php`.
  2. Review the file for any unfamiliar changes or additions.
  3. Remove any suspicious code or restore the file from a backup if necessary.

8. Upgrade to the latest version of PHP

Running your site on an outdated version of PHP can lead to all sorts of issues, including this one. Updating to the latest PHP version can not only potentially fix this error but also improve your site’s performance and security.

Always back up your site before upgrading and test compatibility via a staging environment to ensure a smooth transition.

10Web customers can change PHP versions in the dashboard:

  1. Log in to your dashboard.
  2. Click Manage on the site where you want to change the PHP version.
  3. Click Hosting Services > Tools.
  4. Use the drop down menu to select the new version in the PHP version section.
    Selecting the PHP version from the 10Web dashboard's drop down menu.
  5. Confirm the new version.
  6. Check your site for compatibility.

9. Evaluate your file permissions

Incorrect file permissions on your WordPress files and directories can cause access issues. Ensuring that directories have a permission setting of 755 and files are set to 644 is crucial for maintaining site security and functionality.

Using SFTP to review and adjust permissions for the `wp-admin`, `wp-content`, and `wp-includes` directories, as well as other files in your site’s root directory, can restore proper access levels.

  1. Connect to your site using SFTP.
  2. Right-click on the `wp-admin`, `wp-includes`, and `wp-content` folders and choose File Permissions.
  3. Set the numeric value to 755 for these directories.
  4. For files, select them all (excluding the folders) and set their permissions to 644.

10. Create a new .htaccess file

A corrupt `.htaccess` file can be the source of numerous site issues, including access errors. Renaming and replacing your `.htaccess` file with a default WordPress version can resolve the issue, allowing you to troubleshoot further or establish a new `.htaccess` file with custom configurations.

  1. Connect to your site via FTP and locate the `.htaccess` file in the root directory.The htaccess file seen via FTP in the website's files.
  2. Rename it (e.g., `.htaccess_old`) to deactivate it.
  3. Create a new `.htaccess` file with the default WordPress rules as noted below.
  4. Upload the new file and check if the error is resolved.
#BEGIN WordPress

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCOnd %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

#END WordPress

11. Reset your WordPress site

As a last resort, resetting your WordPress installation can clear the error, albeit at the cost of losing your site’s content. This drastic measure should only be considered after ensuring you have a comprehensive backup to restore from. Various methods, including plugins and WP-CLI, can facilitate this reset, but it’s crucial to proceed with caution and plan for how you’ll restore the content.

Generally, to begin the process of resetting your site and restoring from back up looks something like this:

  1. Ensure you have a complete backup of your site.
  2. Use a plugin like WP Reset or access your site via WP-CLI to reset your site. Follow the plugin’s or WP-CLI’s instructions for resetting.
  3. After resetting, restore your site from the backup, if necessary.

Wrapping Up

The “Sorry, you are not allowed to access this page” error in WordPress can stem from a myriad of causes, from plugin conflicts to database prefix mismatches. By methodically working through these 11 solutions, you stand a good chance of identifying and resolving the underlying issue, restoring your access, and getting back to managing your site effectively. Remember, patience and a systematic approach are your best allies in troubleshooting WordPress errors.

Share article

Leave a comment

Your email address will not be published. Required fields are marked *

Your email address will never be published or shared. Required fields are marked *

Comment*

Name *