0

After 2 weeks not using our WP site, logging into /wp-admin/ gives a whitescreen error:

Sorry, you are not allowed to access this page.

I have:

  • renamed plugins to plugins.temp.
  • created a new admin user via phpMyAdmin. New user has user_meta role of a:1:{s:13:"administrator";s:1:"1";}.
  • renamed themes to themes.temp.
  • deleted core WordPress files, and replaced with newly uploaded files.
  • replaced .htaccess with a default version.
  • CHMOD all folders to 755 and all files to 644 recursively.
  • turned on WP_DEBUG and found no errors.
  • confirmed the site_url & home_url are set correctly in the options table of the db.

all without changing the error.

Help appreciated.

Edit:

  • I've regenerated the security keys without anything changing.
  • The site is singular, not multisite.
  • The problem occurs after clearing cookies, and on all devices.
  • The error occurs immediately after logging in and reaching /wp-admin/.
  • I can get to /wp-admin/index.php but not /wp-admin/ (original error)
  • I can get to /wp-admin/plugins.php but not to /wp-admin/update-core.php (the first time, the same error), but the second time was okay.
15
  • Do you use the Limit Login Attempts plugin? I remember having some issues with this not letting me log in, as someone had exceeded the number of login attempts attempting to break into my site. Perhaps try disabling or resetting this plugin Dec 12, 2021 at 8:23
  • Have you checked the DB? specifically the wp_options table, there are two rows that point to a url, it should be the same url as your domain Dec 12, 2021 at 8:23
  • @Buttered_Toast, yes, they're set correctly.
    – Steve
    Dec 12, 2021 at 14:54
  • 2
    @Steve, are you using Multisite? Does the error happen right after you log in? Have you tried logging in from other pages (if you can) and going to other admin pages like the Plugins or Posts page? Do you remember anything suspicious that you or somebody (an admin on the site) may have done before the issue happened? Have you tried clearing your cookies, caches and/or using a different browser/device to access the site? Try regenerating the security keys?
    – Sally CJ
    Dec 15, 2021 at 2:13
  • 1
    @Steve, 1) Are you using any Must Use plugins (in wp-content/mu-plugins)? If yes, try renaming the folder. 2) I know you've already tried renaming the themes folder, but I'd still try switching to a default (and unmodified) theme like 2021 and see if the same issue persists. 3) Try installing WordPress (the default setup) in another directory or a subdomain in the same site, and see if logging in gives you the same error in question? 4) "turned on WP_DEBUG and found no errors" - maybe Query Monitor would give you some insights?
    – Sally CJ
    Dec 16, 2021 at 2:55

1 Answer 1

0

Because you have renamed the plugin and theme directory, it should a problem on your user. But rename the whole wp-content directory, so that all add-ons are inactive, check it again.

User Rights

After them, logged in to a database tool, like "Adminer" or "PhpMyAdmin" and look at the table usermeta with your user ID*, like

SELECT * FROM wp_usermeta WHERE user_id = '1'`

Check the entries wp_capabilities and you should have the administrator key, like a:1:{s:13:"administrator";b:1;}.

*Note: To identify your user ID, look at the frontend, list all your posts and look at the URL, the key ?author= has your User ID. It is also possible after login in the wp-admin area on links with user keys.

Permalinks

Another chance to fix them is the .htaccess file. Maybe this is not correct, and you have issues with the permalinks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.