Troubleshooting · Troubleshooting
How to Fix "Sorry, You Are Not Allowed to Access This Page" in WordPress
Short answer
This message means WordPress checked your account against the permission for that page and the check failed. The most common causes are a changed user role, a database table prefix that no longer matches wp-config.php after a move, or a plugin blocking access. Check your role first, then the table prefix, then deactivate plugins over SFTP.
Key takeaways
- The message is a WordPress permission check, not a server 403 error.
- WordPress has six default roles, and only Administrator can reach every admin screen.
- An administrator's wp_capabilities value is a:1:{s:13:“administrator”;b:1;} with user level 10.
- A table prefix mismatch after a move is a common cause.
- Files should be 644 and folders 755 in most setups.
What does this error mean?
The message means WordPress ran a permission check for that page and your account failed it.
Every admin page checks a capability, such as manage_options, before it loads. WordPress runs that check through current_user_can(), which tests one capability at a time, the code reference explains.
It is not a server 403 error. A server 403 comes from Apache or Nginx before WordPress loads, while this message comes from WordPress itself after you log in, because a permission setting is blocking you, Kinsta's guide explains.
The message is also normal when a lower role opens a page it should not reach. An Editor who opens the Plugins screen will see it, because installing plugins needs the Administrator role. That case needs no fix; the account simply lacks that capability.
How do you work out where the problem is?
Note where the error appears and what changed just before it, because those two facts point at the cause.
| What you see | Most likely cause | Check next |
|---|---|---|
| Whole dashboard blocked for every admin | Table prefix mismatch after a move | wp-config.php prefix |
| One plugin settings page blocked | Plugin deactivated or its page moved | Plugin list over SFTP |
| Error after a plugin update | Plugin conflict or role change | Deactivate plugins |
| Error after installing a security plugin | Plugin restricts admin access | Security plugin settings |
| Only your account is blocked | Your role was changed | Users screen or database |
If the error started right after a move, check the table prefix first. If it started right after a plugin change, deactivate plugins first.
If you cannot log in at all, see how to fix a locked out of wp-admin first, because that guide covers the login side of the problem.
How do you check your user role?
Check your role first, because a changed role is the fastest cause to confirm.
If you can reach part of the dashboard, open Users → All Users and check the Role column. It should say Administrator if you manage the site.
WordPress has six default roles: Super Admin, Administrator, Editor, Author, Contributor, and Subscriber, WordPress.org's roles guide explains. An Administrator has access to all the administration features within a single site.
If you cannot reach the Users screen, check the database. Open phpMyAdmin, find your user ID in wp_users, then open wp_usermeta and look for the wp_capabilities row.
For an administrator, wp_capabilities should hold a:1:{s:13:“administrator”;b:1;} and wp_user_level should be 10, Kinsta's guide explains. If either value is wrong, WordPress treats you as unauthorized.
The default role for new users is set under Settings → General, so check there if new accounts keep arriving with the wrong role, WordPress.org's roles guide explains.
How do you fix a table prefix mismatch?
A table prefix mismatch means wp-config.php names one prefix while the database tables use another.
WordPress stores your role under a key that starts with the table prefix, such as wp_capabilities. If the prefix in wp-config.php says wp_ but the tables use wp7b_, WordPress looks for the wrong key and finds no role at all.
Open wp-config.php over SFTP and find the $table_prefix line. Then open phpMyAdmin and check the real prefix on your tables, such as wp_users or wp7b_users.
Change $table_prefix in wp-config.php to match the real tables, then save and reload the dashboard. Do not rename the tables unless you know what you are doing.
Back up the database first, because a wrong edit here can lock every user out. Your host panel usually offers a one-click database backup.
How do you rule out a plugin or theme?
Deactivate all plugins over SFTP, because a plugin conflict is the fastest cause to rule out.
Connect over SFTP, open wp-content, and rename the plugins folder to plugins-old. That switches every plugin off at once without deleting anything.
Reload the dashboard. If the error is gone, rename the folder back and reactivate plugins one by one until the error returns. The last one you switched on is the cause.
If plugins are not the cause, switch to a default theme such as Twenty Twenty-Five. Rename your theme folder in wp-content/themes, and WordPress falls back to a default theme.
Keep a note of which plugin you reactivated last. If the error returns after one plugin, check its settings for a role or IP restriction before you delete it, because the fix may be one checkbox, not a replacement.
A bad login redirect can look like a permission error, so rule out a login page that keeps refreshing too.
How do you fix file permissions?
Wrong file permissions can block WordPress from reading its own files, so check them after a move.
WordPress.org's permissions guide lists 755 for folders and 644 for files among the common values on shared hosting, WordPress.org's guide explains. Never set files or folders to 777.
In your host file manager or over SFTP, set folders to 755 and files to 644, starting with the WordPress root and wp-content. Then reload the dashboard.
Permissions are only part of the story. The files must also be owned by the right server user, so ask the host to check ownership if the values look right but the error stays.
How do you create a new admin user if you are locked out?
If no account can reach the dashboard, create a new administrator with WP-CLI or in the database.
WP-CLI is the command-line interface for WordPress, the WP-CLI handbook explains. From the site folder, run wp user set-role with your username and administrator to restore the role, WP-CLI's documentation explains:
wp user set-role yourusername administrator
To create a fresh admin account instead, run wp user create with a login, an email, and the administrator role, WP-CLI's documentation explains:
wp user create newadmin [email protected] --role=administrator
If the lockout followed a hack, see how to recover a hacked WordPress admin account after you regain access, because the attacker may have changed more than your role.
After you regain access, remove any admin account you do not recognize. An unknown administrator may be how the role changed, and leaving it in place leaves the door open.
How do you confirm the fix worked?
The fix worked when your account opens every admin screen without the message.
- Log out and log back in with the fixed account.
- Open Dashboard, Posts, Plugins, and Settings in turn.
- Open the exact page that showed the error before.
- Check Users → All Users and confirm your role reads Administrator.
- If you changed the table prefix, confirm the site loads the front end too.
A 403 from the server is a different error from this message, and how to fix a 403 forbidden error covers that case.
Check the front end too, because a prefix fix that restores the dashboard can still leave menus or widgets wrong. Load the home page and one post, and confirm both render as normal.
What mistakes should you avoid?
Most fixes for this error fail because the database was edited without a backup, or the wrong prefix was changed.
- Editing wp_usermeta without backing up the database first.
- Renaming database tables instead of fixing the $table_prefix line.
- Deactivating plugins from the dashboard you cannot open, instead of using SFTP.
- Setting file permissions to 777 to make the error go away.
- Creating a second admin account and leaving the broken role in place.
Frequently asked questions
Is 'Sorry, you are not allowed to access this page' a 403 error?
No. A 403 comes from the web server before WordPress loads, while this message comes from WordPress itself after you log in. It means your account failed a permission check for that page. Check your role and the table prefix first, because a server fix will not help.
Can a plugin cause this error?
Yes. A security plugin can restrict admin access by IP address or role, and a role editor plugin can change what your account may do. Deactivate all plugins over SFTP by renaming the plugins folder, then reactivate them one by one to find the one that blocks you.
I am the only admin and I am locked out. What now?
Use WP-CLI or phpMyAdmin. With WP-CLI, run wp user set-role with your username and administrator from the site folder. In phpMyAdmin, set the wp_capabilities row for your user to the administrator value and wp_user_level to 10. Back up the database first.
Why did this error appear right after I moved my site?
A move often changes the database table prefix. If wp-config.php still names the old prefix, WordPress looks for your role under the wrong key and finds nothing. Open wp-config.php, read the $table_prefix line, and change it to match the real table names in phpMyAdmin.
Can I fix this from the WordPress dashboard?
Only if you can still reach part of it. If Users → All Users loads, another administrator can restore your role there. If the whole dashboard is blocked, you need SFTP, WP-CLI, or phpMyAdmin, because the dashboard cannot fix a permission it will not grant you.
Sources
- Roles and Capabilities WordPress.org Documentation
- current_user_can() WordPress Developer Resources
- How to Fix the Sorry, You Are Not Allowed to Access This Page Error Kinsta
- Changing File Permissions WordPress Developer Resources
- wp user set-role WP-CLI Command
- WP-CLI Handbook Make WordPress
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
