How to Fix “Sorry, You Are Not Allowed to Access This Page” in WordPress

WordPress access denied illustrated by a locked blue doorway and key

“Sorry, you are not allowed to access this page” is WordPress telling you that your account lacks the permission needed for the screen you opened. It is a permission check, not a crash. The fix is usually to find out which permission is missing and why, rather than to reinstall or reset anything.

Sorry, You Are Not Allowed to Access This Page Error in WordPress
Sorry, You Are Not Allowed to Access This Page Error in WordPress

Work through the checks below in order. They start with quick, reversible checks and only move to database changes once you know what is wrong. Make one change at a time, so you know what fixed it.

Step 1: Note Exactly Where the Error Appears

Before changing anything, answer four questions. The answers usually point straight to the cause:

  • Which URL shows the error? The whole dashboard (/wp-admin/), or one screen such as /wp-admin/admin.php?page=something?
  • Which user are you logged in as, and what role should that account have?
  • Does another administrator account have the same problem?
  • What changed just before it started? A plugin update or deactivation, a migration, a new security plugin, or a change to user roles?
What you seeMost likely cause
One plugin’s settings page shows the errorThe plugin was deactivated or updated and its page address changed, or the plugin limits that page to certain roles.
The whole dashboard shows it for one userThat user’s role was changed or its permissions were removed.
The whole dashboard shows it for every administrator, right after a migrationThe database table prefix in wp-config.php does not match the database.
It started after installing or configuring a security pluginThe plugin is restricting admin access, for example by IP address or by hiding the login URL.
You are on a Multisite network and see it on Network Admin screensThose screens need a Super Admin account, not a site administrator.

Step 2: Rule Out an Old Link or a Missing Plugin Page

If the error appears on one admin page only, go back to Dashboard and open the page from the admin menu instead of a bookmark or an old link. Plugins sometimes rename their settings pages, and a deactivated plugin’s pages no longer exist, so their old URLs show this message.

Also try a private browser window. If you can get in there, log out everywhere and log back in to refresh your login cookies.

Step 3: Check Your User Role

If you can still reach part of the dashboard, go to Users > All Users.

Click on All Users
Click on All Users

Find your account and check the Role column. It should say Administrator if you manage the site.

All Users Section
All Users Section

If you do not see a Users menu at all, your account is not an administrator any more. Ask another administrator to restore your role, or use one of the methods below.

Restore the Administrator Role With WP-CLI

If your host offers SSH and WP-CLI, this is the safest way. Run it in your site’s folder, replacing yourusername:

wp user set-role yourusername administrator

Restore the Administrator Role in phpMyAdmin

Without WP-CLI, you can fix the role in the database. Export a backup of the database first, because a mistake here can lock everyone out.

  1. Open phpMyAdmin from your hosting control panel and select your site’s database.
  2. Open the users table (for example wp_users) and note the ID of your account.
  3. Open the usermeta table and find the row with your user_id and the meta key wp_capabilities. If your table prefix is not wp_, the key uses your prefix instead, for example abc_capabilities.
  4. Edit that row and set meta_value to exactly: a:1:{s:13:"administrator";b:1;}
  5. Click Go to save, then log in again.
PhpMyAdmin Option
PhpMyAdmin Option
Finding for WP Users Table
Finding for WP Users Table
Click on Edit
Click on Edit

Step 4: Check the Table Prefix After a Migration

WordPress stores user permissions in keys that include the table prefix. If a site is moved and the prefix in wp-config.php no longer matches the database, WordPress cannot find anyone’s role, so even administrators are refused.

Open wp-config.php and find the $table_prefix line:

$table_prefix = 'wp_';
Database Prefix
Database Prefix

Then open the database in phpMyAdmin and compare it with the table names.

Table Prefixes Must Align With WP Config File
Table Prefixes Must Align With WP Config File

If the tables start with a different prefix, set $table_prefix to match them. If you changed the prefix on purpose, the prefix must also be updated inside the options table (the user_roles option) and in every usermeta key that starts with the old prefix, such as capabilities and user_level. Back up the database before you change any of these.

Step 5: Test Plugins and the Theme

If roles and the prefix are correct, a plugin may be blocking access. Security and membership plugins are the usual suspects. Test on a staging copy if you have one.

To disable all plugins without the dashboard, open your host’s file manager or connect with SFTP, go to wp-content and rename the plugins folder to something like plugins-off.

Click on the WP Content Folder
Click on the WP Content Folder
Hit the Rename Option
Hit the Rename Option
Click on Rename File Button
Click on the Rename File Button

If you can log in now, rename the folder back to plugins. WordPress will show all plugins as deactivated. Reactivate them one at a time until the error returns, and the last one you activated is the cause.

To test the theme, rename the active theme’s folder in wp-content/themes. WordPress then falls back to an installed default theme, if one is present. Rename it back after testing.

Renaming The Theme Folder Name
Renaming The Theme Folder Name

Step 6: Read the Error Log

If nothing above helps, turn on WordPress’s debug log to see what happens when the error appears. Add these lines to wp-config.php above the line that says “That’s all, stop editing”:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Pasting the Code into WP Config File
Pasting the Code into WP Config File

Reload the page that shows the error, then open wp-content/debug.log. Look for messages that mention a plugin, a role or a capability. Remove the lines again when you are done, because the log can grow large and may contain sensitive details.

What Not to Do

  • Do not reset or reinstall WordPress. This error is about permissions, and a reset deletes your content without fixing the cause.
  • Do not restore an old backup as a first step. A restore throws away every post, comment or order since that backup was made. Use it only when you know the database is damaged and you accept that loss.
  • Do not change file permissions or regenerate .htaccess for this error. Those problems produce different errors, such as 403 Forbidden or 500 Internal Server Error.

If you are still locked out, I can find and fix the cause for you. I confirm the scope and price before I make any changes.

Related Posts

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to our Monthly Newsletter

Get monthly updates of WordPress tips, tricks, and tutorials in your email.

Thanks. You have successfully subscribed.