Monday, 16 August 2021

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

Are you frustrated by the “Sorry, you are not allowed to access this page” error in WordPress?

This error usually displays when you’re trying to see a page in your WordPress dashboard that your user role doesn’t have permission to see.

However, you might see the error sometimes even when you’re supposed to have access to that page. This error can be caused by lot of different reasons which makes it tricky for beginners to troubleshoot.

In this article, we’ll show you how to fix the “Sorry, you are not allowed to access this page” error in WordPress.

How to Fix the 'Sorry, You Are Not Allowed to Access This Page' Error in WordPress

What Causes the “Sorry, You Are Not Allowed to Access This Page” Error in WordPress?

WordPress user roles and permissions define what your users can and can’t do in WordPress. For example, an author on your site wouldn’t be able to edit the post of another author, only their own posts.

If someone gave an author the link to edit someone else’s post, then they would see the “Sorry, you are not allowed to access this page” WordPress error when following the link.

However, sometimes you might see “Sorry, you are not allowed to access this page” when you should have access to view the page.

If you’re not the site owner or administrator, and you’re seeing this error, then you should contact the site owner or admin to let them know. They can explain why you don’t have access to the page, or they can change your role to grant you access.

If you are the site owner or have an admin role, but you’re still seeing the “Sorry, you are not allowed to access this page” error when trying to log in to your own website, then something has gone wrong with the permissions.

Maybe there was an issue with a WordPress update. Maybe there was a problem when a theme or plugin was updated. Or maybe something has gone wrong with your configuration.

If you’re seeing this error when you try to log in, then you won’t be able to fix the error by changing your WordPress settings in the dashboard. You’ll have to work with the files and databases directly.

This can be tricky for beginners and making a mistake could make things worse. As a precaution, we recommend you first make a complete backup of your WordPress website.

You could also start by contacting your hosting provider. They may be able to fix the problem for you.

That being said, here are some steps you can follow to troubleshoot and fix the “Sorry, you are not allowed to access this page” error in WordPress.

Checking You Have the Correct WordPress Role

If you’re able to log in to the WordPress dashboard, but can’t access specific pages, then the issue could be that your WordPress user role was changed, and you’re no longer an admin.

From the WordPress dashboard, you can see your user role by visiting the Users » All Users page, and looking under the ‘Role’ column.

View all users and user roles in WordPress

If you don’t have access to the Users page, then this means that you are not an administrator.

If you or someone else accidentally deleted your administrator account or changed your user role, then you can add a new admin user with phpMyAdmin.

Checking for a Corrupt .htaccess File

If you have an admin user role, and you’re still seeing the “Sorry, you are not allowed to access this page” error, then it could be caused by a corrupt .htaccess file. We can check this by renaming the file.

You will need to use an FTP client or the file manager feature in your WordPress hosting account. If you haven’t used FTP before, then you may want to see our guide on how to use FTP to upload files to WordPress.

Using your FTP client, you need to navigate to the root folder containing all your WordPress files. Once you find the .htaccess file you need to rename it to something else, such as .htaccess.old.

Right Click to Rename .htaccess

If you cannot find your .htaccess file, then see our guide on how to find .htaccess in WordPress.

Once you rename the file, try logging onto your WordPress site to see if that has fixed the problem. If it hasn’t, then rename it back to .htaccess and move on to the next step.

If you can log in, then you fixed the problem. The next step is to generate a new .htaccess file. To do that, navigate to the Settings » Permalinks page in WordPress.

Click Save Changes

Simply click on the Save Changes button at the bottom of the page and WordPress will generate a fresh .htaccess file.

Checking for Incorrect File Permissions

While you have your FTP client open, we’ll check to make sure there isn’t a problem with your file permissions. File permissions control who can access files and folders on your website.

The following settings are recommended for most users:

755 for all folders and sub-folders.
644 for all files.

Using your FTP client, you need to navigate to the root folder containing all your WordPress files and select the wp-admin, wp-content and wp-includes folders. Then you need to right click and select ‘File Permissions’.

Right Click to Select File Permissions

This will bring up the file permissions dialog box.

Now you need to enter 755 in the numeric value field. After that, you can click on the ‘Recurse into subdirectories’ checkbox and then select ‘Apply to directories only’ option.

Folders Should Have Permissions of 755

Click on the OK button to continue. Your FTP client will start setting file permissions to folders and sub-folders. You will need to wait for it to finish.

Next, you need to select all files and folders in the root folder of your WordPress site and then right click to select file permissions.

Right Click to Select File Permissions

The file permissions dialog box would appear.

This time you need to enter 644 in numeric value. After that you need to click on ‘Recurse into subdirectories’ checkbox and then select ‘Apply to files only’ option.

Files Should Have Permissions of 644

Click on OK to continue and your FTP client will now start setting file permission to all files on your WordPress site.

Once you’ve done this, try logging into your WordPress website again. If you’re successful, then you’ve fixed the problem. If not, then move on to the next step.

Deactivating All Plugins Using FTP

If the steps above haven’t resolved the issue, then our next step is to check whether a faulty WordPress plugin is causing the error. We’ll do that by temporarily deactivating all plugins.

First, you need to connect to your website using an FTP client. Once connected, you need to navigate to the /wp-content/ folder.

Right Click to Rename the Plugins Folder

Once there, you will see a folder called plugins. This is where WordPress stores all plugins installed on your website.

You need to right click on the plugins folder and select Rename. Next, you should type in a different name. We will call it ‘plugins.deactivate’.

The Folder is Now Named plugins.deactivated

All of your plugins have been deactivated. Now try to log into your WordPress site to see if this has fixed the problem.

If you still receive the “Sorry, you are not allowed to access this page” error, then the problem isn’t caused by a plugin. You’ll need to rename the ‘plugins.deactivate’ folder back to ‘plugins’ and move on to the next step.

If you can now log in, then you know that one of the plugins is causing the error. We just have to find out which one.

Using your FTP client, rename the ‘plugins.deactivate’ folder back to ‘plugins’ then navigate inside the plugins folder. Now rename the first plugin to something like ‘plugin-name.deactivate’.

Now go back to your site to see if you can log in. If you can’t, then change the plugin’s name back and move on to the second plugin. Repeat the process until you find the one that caused the issue.

Once you’ve found the faulty one, you can switch to a different plugin that doesn’t cause the problem. Or you can contact the plugin author and work with them to come up with a solution.

Activating the Default Theme Using FTP

If the plugin solution didn’t work for you, then we’ll need to check if your WordPress theme could be causing this issue.

This step is similar to deactivating your plugins. You’ll need to connect to your website using an FTP client and navigate to the wp-content folder.

Right Click to Rename the Themes Folder

Once there, you will see a folder called themes. This is where WordPress stores all themes installed on your website.

This time you need to right-click on the plugins folder and select Rename. We’ll call it ‘themes.deactivate’.

This will activate the default theme. Now try to log into your WordPress site to see if this has fixed the problem.

If you still receive the “Sorry, you are not allowed to access this page” error, then the problem isn’t caused by a theme. You need to rename the ‘themes.deactivate’ folder back to ‘themes’ and move on to the next step.

If you can log in, then the previous theme caused the problem and you can start to troubleshoot. You could try using a different theme or reinstall the same theme and carefully configure it.

If the error returns, then report it to the theme author. They may be able to help you solve the problem or fix a bug in the theme.

Final Troubleshooting Steps

If you’re still reading, then unfortunately the other steps haven’t solved your problem. Here are a few more things you can try.

Check Error Log

You may be able to check an error log for clues about what went wrong. Your hosting provider may be keeping logs, or you may have previously set WordPress up to keep them.

For more details, check our guide on how to set up WordPress error logs, or contact your hosting provider.

Update to Latest PHP

If your WordPress site is running an older version of PHP, then it may be causing problems. Upgrading to the latest version may be helpful.

For more information, check our guide on how PHP updates by your web host impact your WordPress site, or contact your hosting provider.

Restore Your Most Recent Backup

If you’ve made a recent backup of your WordPress website, then restoring it to an earlier version is likely to fix the “Sorry, you are not allowed to access this page” error.

The problem is, you will lose any changes to your settings and content made after the backup.

For more information, check our beginner’s guide on how to restore WordPress from backup.

Contact Your Hosting Provider

If you are unable to fix the error on your own, then you should contact your WordPress hosting company to see if there is anything they can do.

Many providers offer excellent technical support and may be able to solve the problem for you.

For example, they may be able to check their server error logs or have created their own backups of your WordPress site. They will be able to advise you on how they can help and what you should do next.

For the best results, make sure you check our guide on how to properly ask for WordPress support and get it.

We hope this tutorial helped you learn how to fix the “Sorry, you are not allowed to access this page” error in WordPress. You may also want to bookmark our ultimate troubleshooting guide of the most common WordPress errors, or see our guide on how to get a free email domain.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Fix the “Sorry, You Are Not Allowed to Access This Page” Error in WordPress appeared first on WPBeginner.



from WPBeginner https://ift.tt/3xKDMGh
More links is https://mwktutor.com

No comments:

Post a Comment