Not allowed 📝 WordPress

WordPress: Sorry, you are not allowed to access this page.

Your user role lacks the capability for that admin screen — or the database table prefix / user capabilities are out of sync after a migration.

Seen on: WordPress

Meaning

WordPress stores roles in {prefix}user_roles and each user’s capabilities in {prefix}capabilities meta. Changing $table_prefix without renaming these option/meta keys makes even admins lose access.

Common causes

  • User role really lacks the capability
  • Plugin page removed/renamed after deactivation (old bookmark)
  • $table_prefix changed but option/meta keys still use the old prefix
  • Security plugin restricting admin pages
  • Multisite: user not a member of that site

⚡ Quick fix

  1. Check the user’s role in Users
  2. Go to the dashboard instead of an old plugin URL
  3. After a prefix change, update {prefix}user_roles, {prefix}capabilities and {prefix}user_level keys
  4. Grant admin via WP-CLI

Detailed fix by platform

WordPress

  1. Restore administrator role with WP-CLI:
    bash
    wp user list --fields=ID,user_login,roles
    wp user set-role admin administrator
    wp option get wp_user_roles --format=json | head -c 200   # replace wp_ with your prefix

How to diagnose

  1. Role — What role does the user have?
  2. URL — Valid admin page?
  3. Prefix — Does $table_prefix match the role/capability keys?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.