WordPress "Sorry, You Are Not Allowed to Access This Page": How to Fix It (2026)

Sorry, You Are Not Allowed to Access This Page - WordPress error fix

You log in as the admin and WordPress shows: Sorry, you are not allowed to access this page. This means WordPress does not see admin permissions for your user. The login itself worked. The permissions are missing or unreadable.

The Short Version

  • WordPress reads your permissions from the database. If it cannot find them, it blocks the page.
  • The most common cause is a changed table prefix: $table_prefix in wp-config.php no longer matches the prefix used in the database tables.
  • Other causes are a plugin conflict, a changed user role, or a bad migration.
  • Compare the prefix first, then check the role, then test plugins.

Why This Error Happens

WordPress stores a user’s role in the usermeta table under a key that starts with the table prefix, followed by capabilities. If the prefix in wp-config.php is different from the prefix in the database, WordPress looks for the wrong key and finds no permissions.

  • A migration or restore used a different prefix.
  • Someone changed $table_prefix without renaming the tables.
  • A security or role plugin changed the roles.
  • The user’s role was changed to something lower than Administrator.

Step 1: Compare the Table Prefix

  1. Open wp-config.php and find the line $table_prefix = 'wp_';.
  2. Open phpMyAdmin and look at your table names, for example wp_users or abc_users.
  3. If they differ, set $table_prefix in wp-config.php to the prefix the tables really use.

Changing the config to match the tables is safer than renaming database rows. Take a backup before you change anything.

Step 2: Check the User Role

If another administrator can log in, ask them to open Users and set your role to Administrator. If you use WP-CLI, run wp user set-role yourusername administrator.

Step 3: Test for a Plugin Conflict

Rename the plugins folder inside wp-content to plugins-off, then try the admin page again. If it works, a plugin is the cause. Rename the folder back and follow our plugin conflict guide.

Step 4: Restore a Backup

If you changed the database by hand and it got worse, restore your backup and start again with Step 1. If you cannot log in at all, our locked out guide helps with passwords.

How to Avoid It

  • Do not change the table prefix on a live site unless you know how to update every row.
  • Back up before a migration.
  • Keep a second administrator account for emergencies.

Verified Facts and Sources

Checked in December 2026. The WordPress developer documentation explains roles and capabilities, and documents the $table_prefix setting in wp-config.php. WP-CLI provides a user set-role command.

Frequently Asked Questions

Why can I log in but not open admin pages?

Your password is correct, so login works. WordPress then checks your permissions. If it cannot read them, it shows this message.

Can a plugin cause this error?

Yes. A security or role plugin can change roles or block admin pages. Rename the plugins folder to test.

Is it safe to change the table prefix in wp-config.php?

Only if it matches the prefix the tables already use. Changing it to a different value without renaming the tables will cause this error.

What if I have only one admin account?

Fix the prefix first. If that does not work, use phpMyAdmin or WP-CLI to set your role, or restore a backup.

Updated December 3, 2026.

More WordPress Error Fixes

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *