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

WordPress站点登录后访问wp-admin页面提示权限错误问题求助

Fixing "Sorry, you are not allowed to access this page." in WordPress wp-admin (Post-Login)

Hey there, let's work through this annoying wp-admin access issue you're dealing with. Since you've already eliminated plugins, themes, and .htaccess as the cause, let's dive into other likely fixes:

1. Verify Your User Role Permissions

It's possible your user account's administrator privileges got corrupted or accidentally changed. Here's how to check and fix this via phpMyAdmin:

  • Log into your hosting control panel and open phpMyAdmin.
  • Select your WordPress database.
  • First, find your user ID by running this query (replace YOUR_USER_EMAIL with your login email):
    SELECT ID FROM wp_users WHERE user_email = 'YOUR_USER_EMAIL';
    
  • Next, check your user's capabilities with this query (replace YOUR_USER_ID with the ID from the previous step):
    SELECT meta_value FROM wp_usermeta WHERE user_id = YOUR_USER_ID AND meta_key = 'wp_capabilities';
    
  • The result should include "administrator":true. If it doesn't, update the capabilities with:
    UPDATE wp_usermeta SET meta_value = 'a:1:{s:13:"administrator";b:1;}' WHERE user_id = YOUR_USER_ID AND meta_key = 'wp_capabilities';
    

Note: If your WordPress table prefix isn't wp_, replace it with your actual prefix (e.g., wp_abc_).

2. Correct Site & Home URL Settings

Mismatched or incorrect site URLs can trigger permission errors. Verify these in phpMyAdmin:

  • In your WordPress database, run this query:
    SELECT option_name, option_value FROM wp_options WHERE option_name IN ('siteurl', 'home');
    
  • Both values should match your actual site URL: https://www.abc.ae (use HTTPS if your site is secured).
  • If either is wrong, update them with:
    UPDATE wp_options SET option_value = 'https://www.abc.ae' WHERE option_name = 'siteurl';
    UPDATE wp_options SET option_value = 'https://www.abc.ae' WHERE option_name = 'home';
    

3. Fix WordPress File & Folder Permissions

Incorrect permissions on wp-admin files can block access. Use FTP or SSH to adjust these:

  • Set the wp-admin folder permissions to 755:
    chmod -R 755 wp-admin/
    
  • Set all .php files inside wp-admin to 644:
    chmod -R 644 wp-admin/*.php
    

Avoid using 777 permissions—they're a major security risk.

4. Reinstall WordPress Core Files

Corrupted core files might be causing the permission issue. Here's how to safely reinstall:

  • Download the latest WordPress zip file from WordPress.org.
  • Extract the zip, then delete the wp-content folder and wp-config-sample.php from the extracted files.
  • Upload the remaining wp-admin and wp-includes folders to your server, overwriting the existing ones.
  • This won't affect your themes, plugins, or settings—just replaces core system files.

5. Check wp-config.php for Misconfigured Constants

Double-check your wp-config.php file for any constants that might restrict admin access:

  • Ensure there's no accidental line like:
    define('ADMIN_COOKIE_PATH', '/wrong-path/');
    
  • If you have security-related constants, temporarily comment them out (add // at the start) to test if they're the cause. For example:
    // define('DISALLOW_FILE_MODS', true);
    

After each step, log out of WordPress and log back in to test access to wp-admin. One of these fixes should resolve the permission error since you've already ruled out the common plugin/theme/.htaccess issues.

内容的提问来源于stack exchange,提问作者Ali Ahmed

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.29 18:47:48