How to Fix “Sorry, You Are Not Allowed to Access This Page” in WordPress
“Sorry, you are not allowed to access this page” is WordPress telling you that your account lacks the permission needed for the screen you opened. It is a permission check, not a crash. The fix is usually to find out which permission is missing and why, rather than to reinstall or reset anything.

Work through the checks below in order. They start with quick, reversible checks and only move to database changes once you know what is wrong. Make one change at a time, so you know what fixed it.
Step 1: Note Exactly Where the Error Appears
Before changing anything, answer four questions. The answers usually point straight to the cause:
- Which URL shows the error? The whole dashboard (
/wp-admin/), or one screen such as/wp-admin/admin.php?page=something? - Which user are you logged in as, and what role should that account have?
- Does another administrator account have the same problem?
- What changed just before it started? A plugin update or deactivation, a migration, a new security plugin, or a change to user roles?
| What you see | Most likely cause |
|---|---|
| One plugin’s settings page shows the error | The plugin was deactivated or updated and its page address changed, or the plugin limits that page to certain roles. |
| The whole dashboard shows it for one user | That user’s role was changed or its permissions were removed. |
| The whole dashboard shows it for every administrator, right after a migration | The database table prefix in wp-config.php does not match the database. |
| It started after installing or configuring a security plugin | The plugin is restricting admin access, for example by IP address or by hiding the login URL. |
| You are on a Multisite network and see it on Network Admin screens | Those screens need a Super Admin account, not a site administrator. |
Step 2: Rule Out an Old Link or a Missing Plugin Page
If the error appears on one admin page only, go back to Dashboard and open the page from the admin menu instead of a bookmark or an old link. Plugins sometimes rename their settings pages, and a deactivated plugin’s pages no longer exist, so their old URLs show this message.
Also try a private browser window. If you can get in there, log out everywhere and log back in to refresh your login cookies.
Step 3: Check Your User Role
If you can still reach part of the dashboard, go to Users > All Users.

Find your account and check the Role column. It should say Administrator if you manage the site.

If you do not see a Users menu at all, your account is not an administrator any more. Ask another administrator to restore your role, or use one of the methods below.
Restore the Administrator Role With WP-CLI
If your host offers SSH and WP-CLI, this is the safest way. Run it in your site’s folder, replacing yourusername:
wp user set-role yourusername administrator
Restore the Administrator Role in phpMyAdmin
Without WP-CLI, you can fix the role in the database. Export a backup of the database first, because a mistake here can lock everyone out.
- Open phpMyAdmin from your hosting control panel and select your site’s database.
- Open the
userstable (for examplewp_users) and note theIDof your account. - Open the
usermetatable and find the row with youruser_idand the meta keywp_capabilities. If your table prefix is notwp_, the key uses your prefix instead, for exampleabc_capabilities. - Edit that row and set
meta_valueto exactly:a:1:{s:13:"administrator";b:1;} - Click Go to save, then log in again.



Step 4: Check the Table Prefix After a Migration
WordPress stores user permissions in keys that include the table prefix. If a site is moved and the prefix in wp-config.php no longer matches the database, WordPress cannot find anyone’s role, so even administrators are refused.
Open wp-config.php and find the $table_prefix line:
$table_prefix = 'wp_';

Then open the database in phpMyAdmin and compare it with the table names.

If the tables start with a different prefix, set $table_prefix to match them. If you changed the prefix on purpose, the prefix must also be updated inside the options table (the user_roles option) and in every usermeta key that starts with the old prefix, such as capabilities and user_level. Back up the database before you change any of these.
Step 5: Test Plugins and the Theme
If roles and the prefix are correct, a plugin may be blocking access. Security and membership plugins are the usual suspects. Test on a staging copy if you have one.
To disable all plugins without the dashboard, open your host’s file manager or connect with SFTP, go to wp-content and rename the plugins folder to something like plugins-off.



If you can log in now, rename the folder back to plugins. WordPress will show all plugins as deactivated. Reactivate them one at a time until the error returns, and the last one you activated is the cause.
To test the theme, rename the active theme’s folder in wp-content/themes. WordPress then falls back to an installed default theme, if one is present. Rename it back after testing.

Step 6: Read the Error Log
If nothing above helps, turn on WordPress’s debug log to see what happens when the error appears. Add these lines to wp-config.php above the line that says “That’s all, stop editing”:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Reload the page that shows the error, then open wp-content/debug.log. Look for messages that mention a plugin, a role or a capability. Remove the lines again when you are done, because the log can grow large and may contain sensitive details.
What Not to Do
- Do not reset or reinstall WordPress. This error is about permissions, and a reset deletes your content without fixing the cause.
- Do not restore an old backup as a first step. A restore throws away every post, comment or order since that backup was made. Use it only when you know the database is damaged and you accept that loss.
- Do not change file permissions or regenerate .htaccess for this error. Those problems produce different errors, such as 403 Forbidden or 500 Internal Server Error.
If you are still locked out, I can find and fix the cause for you. I confirm the scope and price before I make any changes.
