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

1. QuickRead

Few things are more frightening than getting locked out of your own WordPress admin dashboard. If you’ve ever tried to log in and received the notice “Sorry, you are not permitted to access this page,” you know how it feels. The Sorry You Are Not Allowed to Access This Page message, on the other hand, is attempting to assist you.
There are several causes of the error, and most of them may be solved with a few simple abilities. You’ll be back up and running in no time once you’ve narrowed down the problem and fixed it.
This article will provide possible solutions to the “Sorry You Are Not Allowed to Access This Page” issue. Before we proceed, let us provide you with some further information about the error.

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

Although we’re calling it an “error” for the sake of this post, the “Sorry, you are not allowed to access this page” notice in WordPress is intended to be a useful security precaution.
Finally, receiving this message implies that you have a permissions setting that prevents you from accessing a particular area.
This becomes a problem when you are shut out of a part of your site that you should be able to access as an Administrator, which might be anyplace on the backend. When this occurs, it is usually as a result of a recent change to a theme, plugin, or WordPress core.
For a number of reasons, you may encounter the message “Sorry, you are not permitted to view this website.” It’s possible that WordPress isn’t recognising you as an Administrator. In other cases, the information in your site’s core code, a theme, or a plugin may differ from what’s in your database.
Incorrect information in your wp-config.php file or a site running an older version of PHP are other possible culprits. This problem, whatever its cause, may prohibit you from accessing the whole admin section or just a piece of it.
Because you are unlikely to be able to access key settings through the dashboard, you will need to use File Transfer Protocol (FTP) or phpMyAdmin to address this issue. Before you begin troubleshooting, make a backup of your site and brush up on your knowledge of these platforms.
The most aggravating aspect of receiving the “Sorry, you are not allowed to access this page” warning is that it might be difficult to determine which of its causes is at work. Fortunately, there are several options you may try to determine the source of the problem.

3. The Tools You’ll Need Before Tackling the “Sorry You Are Not Allowed to Access This Page Error”

Before you begin to resolve the Sorry You Are Not Allowed to Access This Page issue, you will need a few tools and elements. Here’s a brief summary of what you’ll require:
  • Administrator access to your server is required, at the very least to your root directory.
  • A client for the Secure File Transfer Protocol (SFTP), such as Cyberduck or FileZilla.
  • Before you begin, you may need to polish your FTP abilities.
  • A text or code editor that allows you to deal with the files on your website. Generally, your default text editor is sufficient, but a code editor such as Atom or Notepad++ is preferable.
Once you’ve assembled these components, it’s time to crack your knuckles and dig in!

4. Possible solutions to fix the “Sorry, You Are Not Allowed to Access This Page”

The “Sorry, you are not allowed to access this page” issue requires a great deal of patience to address due to its numerous probable causes. This lengthy list of solutions may be overwhelming, but it also covers a wide range of circumstances to assist you in finding the best one for your site

Restore a previous version of your site

Restoring your site to a previous version is the easiest and often fastest method to get back into your WordPress dashboard. It helps to remember the last modification you made on the site while resolving any issue. After all, such modification might have resulted in the error. It might have been anything from upgrading to a new version of WordPress, moving your site from a local environment, or making significant PHP modifications. You should also think about the most recent plugin or theme you installed (or updated).
If you know what the last modification you made to your site was, reverting it is a straightforward option. This might imply uninstalling the theme or plugin you suspect is to blame or utilizing a plugin like WP Rollback to restore an earlier version. You may alternatively restore your WordPress site from a backup created before the error occurred if you have one.
The disadvantage of this method is that you may lose your recent modifications and will need to find a means to achieve your goals without making the same mistake again.
As a result, you may want to restore your backup to a staging site instead. You may then experiment with other adjustments to figure out what caused the problem. After determining the source of the problem, you may undo the troublesome modification to recover access to your site.

Disable all of your plugins

A recent addition or upgrade of a plugin might be creating the “Sorry, you are not allowed to access this page” warning on your site. If you believe this is the case, your best bet is to disable your plugins one at a time.
If you disable a plugin and the warning disappears, you’ve discovered the root of the problem. You may then address the issue with that plugin (or go without it if it isn’t critical to the functioning of your site)
Of course, if you’re completely locked out of your dashboard, this approach becomes a bit more difficult. You’ll need to connect to your site over SFTP using a client like FileZilla. After that, navigate to wp-content and look for the subdirectory labeled plugins:
We can quickly see if there is a problem here by renaming the folder something other than plugins: like “plugin-name old.” After that, go back and look for the error on your site. If it’s gone, it’s because of a single plugin. To proceed, rename your plugins folder and open it. There are directories for all of your installed plugins inside:
From here, you’ll need to rename each plugin folder in turn and check your site for the error.
Once you’ve identified the offending plugin, you’ll have to make a choice. You might uninstall it completely, choose a replacement, or contact the developer for assistance.
However, if no changes are made to your site, it is possible that a theme is creating the issue.

Activate a default theme

A recent theme change, like your plugins, could have brought your site down. Fortunately, testing for this is similar to testing for plugins. To summarise:
Locate the wp-content/themes directory.
Check the front end of your site after renaming it.
If the error has been resolved, rename the themes folder and go through each individual theme until you locate the cause.
Again, if your theme is critical to your site and workflow, you should contact the developer for assistance. Finding another suitable theme, on the other hand, is most certainly your better option.
Finally, if the issue persists, rename your themes folder and go to the next step.

Check to See if You’re an Administrator

Another possibility is that your user role has been altered accidentally and you are no longer labeled as an Administrator. This is a fairly typical issue with multisite installations. To find out if this is the case, go to phpMyAdmin and look for the wp_users table:
Find your username and make a note of your ID. Then, go to the wp_usermeta table and look for the wp_capabilities row:
If you have Administrator permissions, the meta_value in this row will be as follows:
a:1:{s:13:”administrator”;s:1:”1″;}
If you cannot discover the aforementioned value, it signifies that your admin access has been revoked.
To correct this, go to the wp_capabilities row and click on edit.
Now, paste the code from above into the meta value column and hit Go.
If your access was revoked, you should now be able to log in.

Check your error log to pinpoint the cause

If your access was revoked, you should now be able to log in. This does not immediately repair the problem, but it does offer visual feedback on errors that occur when you visit your website, which can aid in debugging.
The settings may be located in the server’s wp-config file. Follow the instructions below to identify and update the wp-config file.
Connect to your site through FTP and then browse to the WordPress files folder.
Then, right-click the wp-config file and choose view/edit.
Then, as seen below, choose a text editor to examine the file. Alternatively, you may just pick the second option to open using your default editor, such as Notepad.
After you’ve opened the file, use ctrl+F or cmd+F to bring up the search bar.
Now, look for WP_DEBUG and change the line to true.
You should have a command that looks something like the code snippet below.
define( ‘WP_DEBUG’, true );
Save the changes, and then click Yes when requested to submit the revised file. Then, go to your website.
It will provide a list of errors that occur when you attempt to access the page with the problem. These error log reports might assist you in determining the source of the problem and resolving it.

Ensure that your database prefix is correct

A prefix is assigned to each MySQL database. If the one mentioned in your website’s files does not match the one shown in phpMyAdmin, you may see the message “Sorry, you are not allowed to access this page.”
This can happen when transferring your site, such as if you used a local staging site for development and are now migrating to a live server. To check for inconsistencies, navigate to your wp-config.php file.
You may accomplish this using SFTP, as stated in earlier solutions. Once in your wp-config.php file, check for your database prefix (the default is “wp_”):
Then, open phpMyAdmin and look at the table prefixes in your database. They should correspond to the ones specified in your wp-config.php file, as seen in the image below:
If they don’t match the prefix in your wp-config.php file, you’ll need to change it.

Look for changes in your wp-config.php file

Your WordPress website’s configuration settings are all stored in the wp-config.php file. As a result, you’ll want to ensure that it hasn’t been tampered with or altered.
Check your wp-config file to ensure the database details are accurate. This is accessible through your hosting account’s cPanel > File Manager > public_html.
Locate the wp-config file, right-click it, and choose Edit.
PRO TIP: If you do not have access to cPanel, you may access this file using an FTP program such as FileZilla. This method will necessitate the use of your FTP credentials.
You could not know what you’re looking at, in which case, unless you see something unusual, it’s probably OK. File integrity monitoring will be an excellent addition to your future security measures.

Evaluate your file permissions

It’s also possible that the file permissions on your site have been changed. Even though you’re still labeled as an Administrator, WordPress may deem you unable to see some parts of your site in this scenario.
To verify the file permissions on your site, you’ll need to connect to your server through SFTP. Once signed in, navigate to the public_html directory and pick wp-admin, wp-content, and wp-includes in bulk. Choose File Permissions: from the context menu when you right-click on these folders as shown in the image below.
Make sure the following settings are chosen in the subsequent window:
The Numeric Value is set to 755.
The option to recurse into subdirectories is enabled.
Only apply to directories is selected.
When you’re finished, click OK.
Now we’ll change the permissions on the files. To begin, select all of the files in your site directory (ctrl+A to pick all of the files).
When a file is chosen, right-click on it and choose file permissions as shown above.
Make sure the Numerical value is set to 644 in the “Change file attributes” box.
Next, check the box next to “Recurse into subdirectories” and then check the box next to “Apply to files only.”
To apply the updated modifications, click OK.
In summary, the numerical value for directories is 755 while the numerical value for files is 644. This error might be caused by any of the numerical values that deviate from the default value.
If you still receive the same error page after changing the file permissions, try upgrading the PHP version on your hosting account.

Upgrade to the latest version of php

An old version of PHP is a typical source of the “Sorry, you are not permitted to access this page” problem. Furthermore, utilizing an outdated version of PHP might put your WordPress site’s security at risk. As a result, it’s worth checking to see if this resolves the issue.
It is critical to ensure that your site will be compatible with the newest version of PHP before updating. Once you’ve done this, ensure sure your WordPress site is backed up (if it hasn’t previously been).
Before updating, it’s also a good idea to create a local staging copy of your site. This will allow you to test how your site will work with the most recent version of PHP.
There are two ways to upgrade your site permanently once you’ve tried it and are comfortable with how it works with the latest version of PHP. You should be able to upgrade simply from the command line if you have a Virtual Private Server (VPS). If you don’t have this level of access, you can alter it through the control panel or contact your hosting provider for help.

Create a new .htaccess file

If none of the preceding methods work, you may need to reset your .htaccess file. To do this, open FTP and go to the public_html folder.
If you can’t find it, it’s either a hidden file or doesn’t exist owing to your host’s server (usually Nginx). If it’s the latter, you can go to the next step.
Then, similar to how we renamed plugin and theme files in previous solutions, you’ll need to rename your existing ones .htaccess file. It’s best to use a familiar name like .htaccess_original or .htaccess_backup.
Then, right-click on the file and select Download. Open the file in a text editor and replace the following with its contents:
Rename this file .htaccess and submit it to your server. If this file was the source of the “Sorry, you are not allowed to access this page” problem, it should now be fixed.

Reset your WordPress site

If every other remedy you’ve attempted has failed, there are two more options you should explore. We’ve stated it before, but it’s critical to make sure your WordPress site is backed up before attempting either of these methods.
The “Sorry, you are not allowed to access this page” error might occur as a result of a WordPress installation problem. In such a scenario, you’ll need to export your site to a fresh WordPress installation to fix the problem.
The final option is to fully reset your WordPress site. It should be noted that resetting your database will result in the loss of all content on pages and posts, as well as visitor comments. However, if this content has been saved up and is easily accessible, you will be able to recover it following the reset. To do so, navigate to Tools > Export on your dashboard and choose ‘All Content.’ Then choose Download Export File. When the download is finished, we may begin the site reset.

Conclusion

WordPress problems seldom appear at a convenient time. In most cases, you will lose access to both the back end and the front end. This is not the case, however, with the Sorry You Are Not Allowed to Access This Page error. It’s a warning about user permissions rather than a site failure.
However, getting locked out of your WordPress admin panel is nerve-racking, to say the least. Finding the proper solution to the “Sorry, you are not permitted to view this page” issue as soon as possible is critical for both your site and your peace of mind.
As a WordPress user, you must be aware of the probable reasons for frequent problems and know what remedies to attempt. With the troubleshooting solutions we’ve discussed in this post, the “Sorry, you are not allowed to access this page” issue should no longer be a cause of concern.

Latest Posts

3 Comments

  1. Power October 8, 2023 at 9:28 am

    Thank you for the auspicious writeup.

  2. Humancoders October 14, 2023 at 11:06 am

    Hello to eveгy one, it’s actually a nice for me to ρay
    a quick visit this web paցe, it contains precіous Information.

  3. captcha solver online October 16, 2023 at 1:01 am

    Nice ⲣoѕt. Ӏ used t᧐ be checking constantⅼy thіs
    wеblog and I’m impгessed! Extгemely usefu information particularly the closing section :)
    Ӏ deal with such info much. I waѕ lоoking for this
    particular info for a very ⅼengthy time. Тhawnks and good luck.

Leave A Comment