Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
Blog

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

This WordPress message usually means your login succeeded but the account lost a required role or capability. Follow a safe recovery order from role checks and WP-CLI to database repair, plugin isolation, and backup restoration.
WorldWordPress Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If WordPress shows “Sorry, You Are Not Allowed to Access This Page” after you have logged in, your password worked but the account failed an authorization check for the screen you opened. In most cases, the user’s administrator role or a specific capability such as manage_options has been removed, downgraded, or made unavailable.

Start with the least destructive check: confirm the account’s role with WP-CLI or in the database. If the error began after a staging sync, database restore, plugin change, or theme edit, reverse that change or restore a known-good backup. Only then isolate plugins and inspect custom capability code.

As an Amazon Associate I earn from qualifying purchases.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the WordPress error means

WordPress can authenticate you successfully and still refuse to open an administration page. Authentication answers “Who are you?” Authorization answers “Is this user allowed to perform this action?” This message indicates that the second test failed.

An administration screen normally calls current_user_can() with the capability it requires. If the check returns false, WordPress commonly stops the request with its standard “not allowed” message. The account therefore exists and the login session is valid; changing the password will not restore access unless the login itself is also failing.

Capability checks, roles, and meta capabilities

current_user_can() checks the current user’s capabilities and is a wrapper around user_can() that uses the current user object. WordPress converted this implementation in version 5.8.0. A role is a bundle of capabilities, but a screen may test one capability rather than the role name.

Some checks use meta capabilities such as edit_post or edit_user. WordPress maps those to primitive capabilities such as edit_posts and edit_others_posts through map_meta_cap(). That is why restoring a role is usually safer than adding one guessed capability by hand.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

WordPress stores role definitions in the options table under the user-roles setting (normally the site’s database prefix followed by user_roles) and stores each user’s assigned role data in user metadata. Checking roles directly in custom code is discouraged because capability mapping can make a direct role comparison unreliable.

Before changing anything: identify the scope

Record the exact URL or menu item that produces the message, the affected username, and when the problem began. This distinguishes a site-wide role problem from one broken screen.

  • Every administration screen fails: suspect a lost administrator role, damaged role data, or a database-prefix mismatch.
  • Only one settings page fails: the account may still be an administrator but lack a capability such as manage_options, or a plugin may be enforcing an incorrect check.
  • Only one user fails: inspect that user’s role and metadata first.
  • Several users fail immediately after a migration or restore: compare the database and wp-config.php prefixes before editing individual accounts.
  • The problem started after a plugin, theme, or code change: isolate that change after confirming the role.

Make a database backup before editing user metadata, role options, or configuration. A role correction is normally small, but a mistyped serialized value or an edit against the wrong database can affect more than one account.

Choose the safest recovery route

Method Access required Typical speed Risk to live data Best use
Dashboard role check Another administrator account with dashboard access Fast Low Confirming or correcting a single user without touching the database directly
WP-CLI role change Shell access and WP-CLI Fast Low when the user ID is verified Restoring an administrator role from the command line
Database metadata edit Database administration access Fast, but manual Higher When no dashboard or WP-CLI access exists and the backup is verified
Plugin-directory rename FTP or the host’s file manager Fast Low to site data, but plugins stop running Testing whether a plugin causes the capability failure
Backup restoration A known-good site and database backup Depends on the host Can discard newer changes A recent sync, restore, or configuration change clearly caused the failure

Use one route at a time and test after each change. That preserves a useful cause-and-effect trail and makes it easier to undo the last action.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix 1: check the user’s role from the dashboard

This route requires a second account that can still reach the Users screen.

  1. Sign in with the unaffected administrator account.
  2. Open Users and select the affected account.
  3. Inspect the Role field. If the account was changed to Subscriber, Contributor, Author, or Editor, select Administrator and save the user.
  4. Sign out, sign back in as the affected user, and open the previously blocked screen.

If the account already says Administrator but one screen remains blocked, the role may have had a capability removed. A role-management plugin such as User Role Editor can display capabilities; check for the capability the screen requires, including manage_options for many settings pages or edit_pages for page editing. Change only the missing permission you have identified, then test again.

Do not grant every capability as a trial. Broad permissions can create a security problem and can hide the plugin or theme defect that caused the failure.

Fix 2: restore the role with WP-CLI

WP-CLI is the quickest controlled fix when you have shell access. First verify the site path and the user ID; do not guess an ID from a username that may be duplicated or mistyped.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Change to the WordPress installation directory on the server.
  2. List users or otherwise confirm the affected account’s numeric ID.
  3. Set the role with wp user set-role <user_id> administrator.
  4. Run the command against the intended WordPress installation and database, then sign in again.

The command changes the assigned role rather than manually constructing serialized metadata. If it reports that the user does not exist, stop and verify the site path, database connection, username, and ID before trying again.

If the role is restored but the same page still fails, the problem may be a capability removed from the administrator role or code that is denying access independently of the role. Continue with the plugin and theme isolation steps rather than repeatedly assigning the role.

Fix 3: repair the user metadata in the database

Use this method only after taking a database backup and confirming that you are editing the database used by the affected site. Database table prefixes are not always wp_; substitute the actual prefix in every table and metadata key.

Locate the user

  1. Open the site’s user table and identify the affected user’s numeric ID.
  2. Open the corresponding user metadata table.
  3. Filter rows for that user ID and find the capabilities metadata key, normally <prefix>capabilities (often shown as wp_capabilities on a default installation).
  4. Check the role value. For an administrator, one documented representation is a:1:{s:13:"administrator";b:1;}.
  5. Check the companion user-level value, normally <prefix>user_level. The administrator value described in the troubleshooting guidance is 10.

The serialized string must match PHP’s lengths and punctuation exactly. Do not add spaces, smart quotes, or a different character count. If your site uses a custom prefix, the key name changes but the serialized administrator value does not.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make and verify the edit

  1. Export or otherwise preserve the original metadata rows.
  2. Change only the affected user’s capability and level rows, using the exact values appropriate to the administrator role.
  3. Save the change and clear any object or page cache that could preserve the old session or menu.
  4. Start a new browser session, sign in again, and test the original screen.

If the account immediately loses the role again, a plugin, theme, scheduled task, migration process, or synchronization job is rewriting the metadata. Fix that writer instead of repeatedly repairing the row.

Fix 4: check for a database-prefix mismatch

WordPress needs the prefix configured in wp-config.php to match the tables that contain the site’s roles and user metadata. A migration, restored backup, or manual configuration edit can leave the application looking in one prefix while the role data remains under another.

  1. Open wp-config.php and note the value assigned to $table_prefix.
  2. In the database, identify the tables that begin with that exact prefix.
  3. Confirm that the users, user metadata, options, and role data for this site use the same prefix.
  4. Look for a second set of tables with a different prefix that contains the expected users and role information.
  5. Correct the configuration or database arrangement only after taking a backup and confirming which set is the live site.

A prefix mismatch can make WordPress appear to have no role data, so assigning a role in the wrong table will not solve the error. If you are uncertain which database belongs to the site, ask the host or compare the database name and credentials in wp-config.php before changing anything.

Fix 5: isolate plugins when the role is correct

Plugin code can add capability checks or alter role definitions. If the dashboard is unreachable, disable plugins without deleting their files:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Use FTP or the host’s file manager to open the site’s wp-content directory.
  2. Rename the plugins directory to a temporary name such as plugins.hold.
  3. Start a new login session and test the blocked page.
  4. If access returns, rename the directory back to plugins.
  5. Reactivate plugins one at a time, testing the page after each activation, until the failing plugin is identified.

Renaming the directory disables all standard plugins at once, so forms, caching, security rules, and other features may stop temporarily. Do not leave production functionality disabled longer than necessary. Once the offending plugin is identified, update it if a compatible release exists, remove its faulty capability rule, or restore the site from a backup made before the change.

If renaming the directory has no effect, restore the original name before moving on. The failure may be in the active theme, a must-use plugin, a network-level plugin, or the stored role data rather than in a standard plugin.

Fix 6: inspect theme and custom capability code carefully

General troubleshooting reports include faulty plugin or theme capability checks as a cause. Code in the active theme’s functions.php is not established as a universal cause, so treat this branch as a site-specific inference, especially when the failure began immediately after a snippet was added.

With a backup and a way to restore the file, search recent changes for code that calls or modifies:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • current_user_can
  • add_cap
  • remove_cap
  • set_role
  • map_meta_cap
  • hooks such as init that run on every request

Comment out or revert only the recent, relevant change, then test with a fresh session. Do not delete an entire theme file to test one snippet. If the code belongs to a custom plugin or theme supplied by a developer, provide the exact blocked URL, user role, and recent change so the developer can reproduce the capability decision.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Fix 7: restore a known-good backup

Restoration is appropriate when a staging synchronization, database restore, migration, or manual change clearly precedes the error and you have a backup from before that event. Prefer a backup whose database and files belong to the same point in time.

  • Confirm the backup date and what it contains: database, uploads, plugins, themes, and configuration.
  • Export or snapshot the current site first if the host permits it, so newer content is not irretrievably lost.
  • Restore in the host’s documented order, commonly database and files as one matched set.
  • Test login, the affected administration page, publishing, media, and any forms before declaring the recovery complete.
  • Investigate the sync or change that caused the role loss before repeating it.

A restore can remove legitimate edits made after the backup, so use it for a confirmed regression rather than as the first response to an isolated missing capability.

Why the error can return after a successful fix

Repeated role loss is evidence of an ongoing writer or a mismatch, not a reason to keep editing the same user row. Check these possibilities in order:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. A deployment or staging-sync job is copying lower-privilege user metadata over production.
  2. A restored database contains an older role definition or uses a different prefix.
  3. A plugin or theme runs set_role, add_cap, or remove_cap during initialization.
  4. A role-management tool saved an incomplete role definition.
  5. You corrected one site in a multisite installation while the blocked screen belongs to another site’s role context.

Capture the time of each change and compare it with deployment logs, scheduled tasks, plugin activation, and database imports. Once the writer is removed or corrected, assign the intended role one final time and verify it in a new session.

Verification checklist after access returns

  • The affected user can open the original screen without the error.
  • The role shown in the Users screen matches the intended role.
  • The user can perform only the actions that role is meant to permit.
  • Other administrator accounts retain access.
  • Plugins, the active theme, caching, and scheduled tasks still operate normally after any isolation test.
  • The database backup or pre-edit export is stored safely.
  • The change that caused the permission loss has been identified or documented as unresolved.

Preventing another authorization failure

Keep production and staging databases clearly separated, and review deployment procedures that copy users, user metadata, or the options table. A file-only deployment should not silently overwrite production role data with a lower-privilege staging snapshot.

Record intentional role changes and limit administrator access to accounts that need it. When adding custom access rules, test both an administrator and a lower-privilege account in a staging environment. Use capability checks for authorization instead of direct role-name comparisons, because WordPress maps meta capabilities according to the object and context.

Maintain recent, restorable backups of both the database and files. A backup that contains only uploads cannot restore role metadata, while a database-only restore may leave plugin or theme code that recreates the problem. After migrations and restores, test a real administrator login and at least one restricted account before handing the site back to editors.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.