You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress后台登录提示‘Sorry, you are not allowed to access this page.’问题求助

Hey there, sorry to hear you're hitting that frustrating "Sorry, you are not allowed to access this page." error when trying to get into your WordPress dashboard. Since disabling all plugins didn't fix it, let's walk through some other common fixes that usually resolve this issue:

Fixes for the WordPress Dashboard Access Error

1. Double-Check Your User Role Permissions

It's possible your user role got accidentally changed (maybe from a botched update or a misconfig somewhere). Here's how to confirm and fix it:

  • Log into your hosting control panel and open phpMyAdmin (most hosts have this under "Databases").
  • Find your WordPress database, then open the wp_users table. Locate your user entry and note down your ID number.
  • Next, open the wp_usermeta table. Search for rows where user_id matches your ID and meta_key is wp_capabilities (if your database uses a different prefix than wp_, use that instead).
  • Look at the meta_value field—if you're supposed to be an admin, it should have administrator listed. If not, edit the value to:
    a:1:{s:13:"administrator";b:1;}
  • Save the change, then try logging into the dashboard again.

2. Switch to a Default WordPress Theme

Custom themes can sometimes mess up permission checks, even with plugins disabled. Here's how to test this:

  • Use FTP or your hosting file manager to go to /wp-content/themes/.
  • Rename your active theme's folder (add -old to the end, like my-custom-theme-old). WordPress will automatically fall back to a default theme like Twenty Twenty-Four.
  • Try accessing the dashboard again. If it works, your theme was the problem—you can either troubleshoot the theme code or switch to a new one.

3. Reset Your .htaccess File

A corrupted .htaccess file is a common culprit for access issues. Let's fix that:

  • In your site's root directory (where wp-config.php lives), find the .htaccess file.
  • Rename it to .htaccess-old to disable it temporarily.
  • If you can log in, go to Settings > Permalinks and click "Save Changes"—this generates a fresh, properly configured .htaccess file automatically.
  • If you can't log in to save permalinks, manually create a new .htaccess file with this default content:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    
  • Test accessing the dashboard again.

4. Check wp-config.php for Restrictive Settings

Sometimes lines in wp-config.php can block admin access without you realizing it:

  • Open wp-config.php via FTP or file manager.
  • Look for lines like define('DISALLOW_FILE_EDIT', true);—that's normal for security, but if you see something like define('ADMIN_COOKIE_PATH', '/wrong-path/') or other odd restrictive defines, comment them out by adding // at the start (e.g., // define('ADMIN_COOKIE_PATH', '/wrong-path/')).
  • Save the file and try logging in again.

5. Fix Incorrect File Permissions

Wrong file permissions can prevent WordPress from accessing the files it needs for the dashboard. Stick to these safe settings:

  • Directories: Set permissions to 755
  • Files: Set permissions to 644
  • wp-config.php: Set to 600 (extra secure, prevents unauthorized access)
  • Most FTP clients let you set permissions recursively, but never set everything to 777—it's a huge security risk.

If none of these work, try reuploading the core WordPress files (excluding wp-content and wp-config.php). Download the latest WordPress version, extract it, then upload the wp-admin and wp-includes folders via FTP, overwriting the existing ones. This replaces any corrupted core files that might be causing the issue.

内容的提问来源于stack exchange,提问作者shubham shah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:24:01