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_prefixinwp-config.phpwas 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
- Disable plugins. In File Manager, rename
wp-content/pluginstoplugins-off, then try wp-admin. If it works, rename it back and find the plugin with the plugin conflict method. - Check the table prefix. Open
wp-config.phpand note$table_prefix(for examplewp_). In phpMyAdmin, the tables should start with the same prefix. - Check usermeta keys. In the
PREFIX_usermetatable, your user should havePREFIX_capabilitiesandPREFIX_user_level. If they use an old prefix, rename them to match. - Check the options key. In
PREFIX_options, theoption_namePREFIX_user_rolesmust use the current prefix too. - Restore the admin role. Set
PREFIX_capabilitiesfor your user toa:1:{s:13:"administrator";b:1;}andPREFIX_user_levelto10. - 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.
