Home » wp-admin » Sorry, You Are Not Allowed to Access This Page in WordPress (Fix)

Sorry, You Are Not Allowed to Access This Page in WordPress (Fix)

You log in as an administrator, click Dashboard or Plugins, and WordPress stops with a plain white page: “Sorry, you are not allowed to access this page.” Sometimes it is one screen, sometimes all of wp-admin.

It happens most often right after a migration, a table prefix change or a role editor plugin, and to people who bookmarked a settings page of a plugin they later removed. The account usually still exists and the password still works. What broke is what WordPress thinks that account is allowed to do.

Core shows this message when the current user does not have the capability that the requested admin screen needs. It does not redirect you anywhere, it just stops the request. So the fix is always one of two things: you asked for a screen that no longer exists, or your user lost its capabilities.


Look at the URL. If it is something like /wp-admin/admin.php?page=some-plugin-settings and only that one screen fails, the plugin that registered the page is probably deactivated or deleted. WordPress can’t find a menu entry for it, so it treats the page as one you are not allowed to see.

Open /wp-admin/index.php directly. If the Dashboard loads, your account is fine. Reactivate the plugin or remove the old bookmark and you are done.

On Multisite, the screens under /wp-admin/network/ need a Super Admin. A site administrator gets this exact message there, and that is expected.

If the Dashboard itself fails, keep going.


Every fix below touches the users, usermeta or options tables. Export the database before you change anything:

wp db export before-caps-fix.sql

You should get a “Success: Exported to ‘before-caps-fix.sql’.” line. No SSH? Use the Export tab in phpMyAdmin.

Replace admin with your username, email or user ID:

wp user get admin --field=roles
wp user list-caps admin | grep -E '^(read|manage_options|activate_plugins)$'

A healthy administrator prints administrator for the first command and all three capabilities for the second. Now compare that with what you see:

  • The role is empty or something like subscriber: the user’s role was changed or lost. Go to Step 3.
  • The role says administrator but capabilities are missing: the administrator role itself is damaged. Go to Step 4.
  • The site was just migrated or the table prefix was changed: go to Step 5 first, because Steps 3 and 4 will not stick until the prefix matches.
wp user set-role admin administrator

Log out, log back in and open the Dashboard. If you can’t trust the old account at all (for example after a hack), create a fresh administrator instead with one of the methods in 5 easy ways to create a WordPress admin user.

Role editor plugins save their changes to the database, so removing the plugin does not undo them. If someone unticked manage_options or read on the Administrator role, every admin on the site is locked out the same way.

wp role reset administrator

This puts the role back to the capabilities of a fresh install. If several default roles look wrong, wp role reset --all resets all of them. According to the wp role reset documentation, custom roles are not affected, so roles added by WooCommerce or a membership plugin keep their settings.

💡 Plugins that add their own capabilities to the Administrator role (shop managers, SEO settings) re-add them on activation. If a plugin screen still refuses you after the reset, deactivate and reactivate that plugin.


This is the cause I would check first after any move or “security hardening” that renamed the tables. WordPress does not store roles in a column. It stores them in keys that include the table prefix:

  • {prefix}user_roles in the options table holds the role definitions.
  • {prefix}capabilities and {prefix}user_level in the usermeta table hold each user’s role.
See also  Allowed Memory Size Exhausted in object-cache.php: Redis Fix

Rename the tables from wp_ to abc_ and set $table_prefix = 'abc_'; in wp-config.php, and WordPress now looks for abc_capabilities. The rows still say wp_capabilities, so your account has no role and every admin screen is denied. Login still works because the users table has nothing prefixed inside it.

Find the prefix WordPress uses:

wp config get table_prefix

Then see which keys the database actually holds. Here the new prefix is abc_:

SELECT option_name FROM abc_options WHERE option_name LIKE '%user_roles';

SELECT user_id, meta_key FROM abc_usermeta
WHERE meta_key LIKE '%capabilities' OR meta_key LIKE '%user_level';

If those queries return wp_user_roles and wp_capabilities instead of the abc_ versions, rename them:

UPDATE abc_options
SET option_name = 'abc_user_roles'
WHERE option_name = 'wp_user_roles';

UPDATE abc_usermeta
SET meta_key = 'abc_capabilities'
WHERE meta_key = 'wp_capabilities';

UPDATE abc_usermeta
SET meta_key = 'abc_user_level'
WHERE meta_key = 'wp_user_level';

💡 Replace abc_ with the prefix from wp-config.php and wp_ with the old one. If an abc_user_roles row already exists next to the old one, delete the empty new row first, otherwise the rename creates a duplicate.

You can run these in phpMyAdmin’s SQL tab or with wp db query. Flush the object cache afterwards with wp cache flush so a persistent cache doesn’t keep serving the old, empty roles.

If you only have phpMyAdmin, find your user ID in the users table, then write the administrator role straight into usermeta. The value is a serialized PHP array, so copy it exactly:

UPDATE wp_usermeta
SET meta_value = 'a:1:{s:13:"administrator";b:1;}'
WHERE user_id = 1 AND meta_key = 'wp_capabilities';

UPDATE wp_usermeta
SET meta_value = '10'
WHERE user_id = 1 AND meta_key = 'wp_user_level';

Use your real prefix in both the table name and the meta key, and your own user ID. If the query reports “0 rows affected”, the row doesn’t exist under that key, which usually points back to the prefix problem in Step 5. The same phpMyAdmin workflow is in how to reset a WordPress password from phpMyAdmin if you also lost the password.

This fixes the one account. If the role definitions in wp_user_roles are damaged too, run wp role reset --all as soon as you have WP-CLI, or the other admins and editors stay broken.


All of the fixes above are quicker with WP-CLI than through phpMyAdmin. In cPanel you need SSH or the Terminal feature, and some shared hosts turn both off. In OpenPanel, WP-CLI is preinstalled in every PHP container. You run it from the web terminal or from a cron job set to the site’s PHP container, and you add --allow-root, for example wp user set-role admin administrator --path=/var/www/html/example.com --allow-root.

Never edit the Administrator role in a role editor plugin. Create a custom role and change that instead, so wp role reset always has a clean default to go back to.

When you change the table prefix, rename the prefixed option and usermeta keys in the same step as the tables. Good migration tools do it for you. A manual RENAME TABLE does not.

If wp-admin sends you to profile.php instead of showing this message, that is a different problem, usually a redirect snippet in a plugin or theme. I cover it in wp-admin redirects to profile.php. The Roles and Capabilities page lists which capabilities each default role should have, if you want to compare.

TL;DR: “Sorry, you are not allowed to access this page” means your user is missing the capability for that screen. Rule out a deleted plugin’s page, then back up, check the role with wp user get, and fix it with wp user set-role or wp role reset administrator. After a migration or prefix change, rename wp_user_roles, wp_capabilities and wp_user_level to the new prefix first.

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended