Dev Notes

“Sorry, You Are Not Allowed to Access This Page” in WordPress: 8 Fixes That Work

Not Allowed to Access This Page?: 8 fixes for the WordPress admin error
Dev Notes February 17, 2023 Tamir Khan No Comments

Quick answer

WordPress shows “Sorry, you are not allowed to access this page” when your user account doesn’t have the capability the page needs. The usual causes are a plugin or theme update that changed permissions, a changed database table prefix after a migration, a corrupted administrator role, a security plugin rule, or an incompatible PHP version. Start by disabling plugins via FTP or WP-CLI, then check your role in the wp_usermeta table.

Key takeaways

  • Back up files and the database before you change anything.
  • Renaming wp-content/plugins (or wp plugin deactivate –all) quickly shows whether a plugin is the cause.
  • After a migration, a mismatched table prefix in wp_usermeta is the most common cause.
  • WP-CLI can reset your role in one command: wp user set-role yourname administrator.
  • Restore a backup only after the quicker fixes fail.

You log in to WordPress and, instead of the dashboard, you see a plain page: “Sorry, you are not allowed to access this page.” It often appears right after an update, a migration to new hosting or a change to a security plugin. The good news is that it is almost always fixable in a few minutes without losing content. Work through these fixes in order.

What causes “Sorry, you are not allowed to access this page”?

WordPress checks your user’s capabilities before showing any admin screen. The message appears when that check fails. Causes, from most to least common:

CauseTypical trigger
Plugin or theme conflictAn update changed or removed capabilities
Database table prefix mismatchMigration, staging push or changed $table_prefix
Administrator role corrupted or removedRole-editor plugin, hack, faulty update
Security plugin ruleWordfence, iThemes/Solid Security, IP or country block
PHP version incompatibilityHost upgraded PHP; old plugin code fails
Wrong file permissions or corrupt core filesFailed update, manual uploads

Fix 1: Back up first

Download the site files and export the database from your hosting panel (or run wp db export) so every change below is reversible.

Fix 2: Deactivate all plugins

Using FTP, SFTP or your host’s file manager, rename wp-content/plugins to plugins-off. Or with WP-CLI:

wp plugin deactivate --all

Try logging in again. If it works, rename the folder back and reactivate plugins one at a time until the message returns. That plugin is the cause: update it, replace it or contact its developer.

Fix 3: Switch to a default theme

Rename your active theme’s folder in wp-content/themes, or run wp theme activate twentytwentyfive. WordPress falls back to a default theme. If you get in, the theme is the problem.

Fix 4: Check the database table prefix

Open wp-config.php and note the prefix, for example $table_prefix = 'wpx7_';. In phpMyAdmin, check two places use the same prefix:

  • In the wpx7_options table, the option name must be wpx7_user_roles.
  • In the wpx7_usermeta table, keys must be wpx7_capabilities and wpx7_user_level, not wp_capabilities.

Rename any keys still using the old prefix. This is the fix for most “after migration” cases.

Need a website that turns visitors into enquiries?

My team builds fast, secure, SEO-ready websites and web apps for growing businesses.

Get a website quote WhatsApp me

Fix 5: Restore your administrator role

With WP-CLI:

wp user list --fields=ID,user_login,roles
wp user set-role yourname administrator

Without WP-CLI, in phpMyAdmin find your user ID in wp_users, then in wp_usermeta set wp_capabilities for that ID to:

a:1:{s:13:"administrator";b:1;}

and wp_user_level to 10. Use your real prefix instead of wp_.

Fix 6: Check your security plugin and server rules

Temporarily rename the security plugin’s folder. Also check .htaccess for rules that deny wp-admin to your IP, and your host’s firewall or ModSecurity logs if you were recently blocked.

Fix 7: Check the PHP version and error log

In your hosting panel, see which PHP version the site runs. Current WordPress works best on PHP 8.3 or newer. Turn on logging in wp-config.php:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Reload the page and read wp-content/debug.log. Errors naming a plugin or theme file point straight to the culprit. Turn debugging off afterwards.

Fix 8: Reinstall WordPress core files and check permissions

Run wp core download --force --skip-content, or upload fresh wp-admin and wp-includes folders from wordpress.org. Typical permissions are 755 for folders and 644 for files, with wp-config.php at 600 or 640.

What if nothing works?

Restore the most recent backup from before the problem started, then repeat the update or migration carefully on a staging copy. If the site was hacked (unknown admin users, strange files), clean it before restoring access.

How do I prevent this error?

  • Test plugin and core updates on a staging site first.
  • Use a migration tool that handles the table prefix, or search-and-replace prefixes deliberately.
  • Keep at least two administrator accounts with strong passwords and two-factor login.
  • Keep daily off-site backups.

Frequently asked questions

Why do I get “Sorry, you are not allowed to access this page” as an administrator?

Your account’s capabilities are missing or unreadable. This usually happens after a plugin update, a database prefix change during migration, or a corrupted administrator role.

Can a plugin cause the not allowed to access this page error?

Yes. Plugins that manage roles, memberships or security, and plugins with bugs after an update, are common causes. Deactivating all plugins via FTP or WP-CLI is the quickest test.

How do I fix it after migrating WordPress?

Make sure the table prefix in wp-config.php matches the prefix used in the user_roles option and in the capabilities and user_level keys in the usermeta table.

Will I lose content fixing this error?

No. Content is stored in the database and is not affected by deactivating plugins, switching themes or fixing roles. Take a backup first anyway.

Tamir Khan: business growth and digital strategy consultant in Mumbai. Since 2011 he has built websites, SEO, Google Ads, cloud and automation systems for businesses in India, the UK, Canada, the USA and the UAE. Strategy comes from Tamir; delivery is by the NexGeno team. About Tamir · LinkedIn

Last updated: 25 November 2026

Related Posts

Quick Links

Newsletter

I am the Founder and Chief Technology Officer at NexGeno Technology Pvt Ltd. With 12+ years of experience, I specialize in digital strategy, business automation, AI integration, web development, and marketing.I've worked with startups, SMEs, and global clients, offering tailored strategies that deliver measurable results.

© 2025 Tamir Khan - All Rights Reserved | Managed by NexGeno