WordPress

Fix "Sorry, you are not allowed to access this page" in WordPress

Seeing "Sorry, you are not allowed to access this page" in wp-admin? Learn the causes, from lost admin roles and table prefix mismatches to plugins, and how to regain access.

IntermediateWordPress on cPanel hosting2 min read

The WordPress message "Sorry, you are not allowed to access this page" means you are logged in, but your user account does not have the capability needed for that admin screen. When it appears on every admin page, your administrator role has usually been lost or WordPress cannot read it from the database.

Before you start

  • Access to cPanel → Databases → phpMyAdmin and File Manager.
  • A backup of the database before editing it.

Common causes

  • Table prefix mismatch after a migration – $table_prefix in wp-config.php was changed but the meta keys still use the old prefix.
  • Your role was changed by another admin, a plugin, or a compromise.
  • A plugin removed or restricted capabilities (membership, role editor or security plugins).
  • Only one page fails – the plugin that owns it was deactivated or you are not allowed in by design.

How to fix it

  1. Disable plugins. In File Manager, rename wp-content/plugins to plugins-off, then try wp-admin. If it works, rename it back and find the plugin with the plugin conflict method.
  2. Check the table prefix. Open wp-config.php and note $table_prefix (for example wp_). In phpMyAdmin, the tables should start with the same prefix.
  3. Check usermeta keys. In the PREFIX_usermeta table, your user should have PREFIX_capabilities and PREFIX_user_level. If they use an old prefix, rename them to match.
  4. Check the options key. In PREFIX_options, the option_name PREFIX_user_roles must use the current prefix too.
  5. Restore the admin role. Set PREFIX_capabilities for your user to a:1:{s:13:"administrator";b:1;} and PREFIX_user_level to 10.
  6. Or use WP-CLI over SSH: wp user set-role youruser administrator.

Warning: If you did not change anything and your role disappeared, check the Users list for unknown administrators. Unexpected role changes can be a sign of a hacked site.

What to check afterwards

Log out and back in, then open Settings, Plugins and Users to confirm full admin access.

FAQ

Why did this start after moving my site?

The table prefix in wp-config.php probably does not match the database. Fix the prefix or the meta keys.

Can I fix it without phpMyAdmin?

Yes, with WP-CLI, or by creating a new admin user through a database query.

Is resetting my password enough?

No, the password is fine; the role is the problem. See reset the admin password only if you also cannot log in.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.