While accessing your WordPress admin dashboard and trying to log in, you can get an issue with a message –
“Sorry, you are not allowed to access this page.”
You can fix this issue with several options and quickly get back to your WordPress admin page.
Cause for this Error
There could be various causes of this error:
- A permission issue
- Incorrect information in the wp-config.php file
- An outdated PHP version
Here, we have mentioned a few solutions that might fix your issue, and you can try these options individually.
1. Disable all the Plugins
WordPress admin page error – Sorry, you are not allowed to access this page – it could be triggered after adding a new plugin or upgrading an existing plugin.
- You can try to disable the plugins one by one.
- If the site starts working after the plugin update, you will need to troubleshoot to spot the plugin causing the issue, or you can remove the same plugin if not required.
You can click here to know How to disable/deactivate plugins in WordPress.
- After deactivating the plugin, rename the plugin folder inside the plugin directory.
2. Activate a Default Theme
If you have just updated a WordPress theme, that might be a potential cause of the same error.
- Activate the default theme for the website to give a check.
- You will need to troubleshoot the newly updated plugin if the error is fixed.
- To disable the theme triggering the error, you need to connect FTP to your WordPress, go to the wp-content > themes path, and then find the theme and rename it.
3. Check Your Error Log and Find the Cause
It is always a good idea to check the error log to troubleshoot the issue.
- Inside WordPress, you will find a file called error.log file.
- Here, you may find the exact issue which is causing the error.
- You may find an incompatible plugin or theme that may have caused the issue.
- Troubleshoot the error you found in the error.log file, which will fix your issue.
4. Ensure Your Database Prefix is Correct
- Each MySQL database contains a prefix. Although you must check the MySQL tables and verify them in the wp.config.php file, both should be similar.
- Inside wp.config.php, you will find the option – $table_prefix = 'your table prefix'.
- If these both don't match, you may receive the - Sorry, you are not allowed to access this page error.
You may refer to How to change the WordPress database table prefix for more details.
5. Your User should be the Administrator
- You will need to ensure that the user you are trying to log in to is an administrator, or you will receive the same error.
- To verify the user, access the phpMyAdmin and check for the wp_user table and get the username and user_id.
- Now, go to the wp_usermeta table and check for the wp_capabilities.
- If your meta value is showing other than the one mentioned above, you can change it by clicking on the edit button.
- You can also create another WordPress admin user from phpMyAdmin.
6. Verify if there are any Changes in the wp-config.php File
- You will need to identify if there are any changes to your WordPress wp-config.php file.
- You can connect to FTP and find out if there are any changes.
- You can verify the wp-config.php file to fix your issue.
7. Change to the Latest PHP Version
- An irrelevant PHP version of your WordPress may be the source of the same issue.
- You can try to upgrade your PHP version to fix the error.
For more details, refer to How to change the PHP version in cPanel.
8. Check for the File Permissions
- If Wordpress files/folders permission is changed, you may receive such an error though your user is an administrator.
- WordPress will consider it unauthorized to log in.
- You will need to check the folder permission such as public_html, wp-admin, wp-content, and wp-includes.
- If you are using the cPanel, all the folder permission should be 755, and file permission should be 644.
Refer to How to change file permission in cPanel for more details.