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:
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.