WordPress站点登录后访问wp-admin页面提示权限错误问题求助
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_EMAILwith 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_IDwith 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-adminfolder permissions to755:chmod -R 755 wp-admin/ - Set all
.phpfiles insidewp-adminto644: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-contentfolder andwp-config-sample.phpfrom the extracted files. - Upload the remaining
wp-adminandwp-includesfolders 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

