Issue

After moving a WordPress blog to a new server admin user can no longer access admin control panel. The same user can login to the website front-end with no issues, but as soon as he tries to access wp-admin page the following error is displayed:

Sorry, you are not allowed to access this page.

 

Resolution

I had the same error on 2 different occasions (2017 and 2024), with different sites, migrated between different providers. Both had different causes and resolutions.

Website 1

The issue was caused by modified table prefixes on WordPress MySQL database. Even though the correct prefix was entered in wp-config.php file, there were some leftover references to the old prefix in some MySQL tables. Specifically:

  • _usermeta table had bunch of references to the old prefix in meta_key column
  • _options table had one reference in option_name column (<prefix>_user_roles)

Replacing old prefixes with the correct ones resolved the issue.

Website 2

In this case, the issue was caused by a WordPress plugin, specifically eventON Calendar. Disabling the plugin, immediately restored admin area functionality. We didn't really need this plugin anymore, so I didn't investigate further and simply removed the plugin completely.

If you are wondering how to disable plugins when you don't have access to the WordPress Admin:

  • Open your web hosting file manager (FTP, WinSCP, Plesk, etc.) and navigate to your website's root > htdocs/wp-content/plugins
  • Initially, you can rename the whole plugins folder (which disabled all plugins).
  • If this resolves the issue, restore plugins folder name, and instead rename plugin folders inside one by one, until you find the culprit.

2017-2024
WordPress 4.7.2 - 6.4.2

No comments

Leave your comment

In reply to Some User
Captcha Image