I just experienced the “Sorry, You Are Not Allowed To Access This Page” issue on a new website, and even though there are plenty of extended lists with solutions, none was helpful for my case.
I was creating a copy of one of my websites using the fantastic WP Migrate DB plugin.
The frontend of the copy worked great, but I wasn’t able to log in as an admin user. When I tried, “Sorry, You Are Not Allowed To Access This Page” was showing up.
Long story short, none of the top search results for that topic addressed my issue and specific circumstances.
The cause: changing the table prefix.
Luckily, I quickly remembered that I changed the table prefix in my
wp-config.php and also renamed all the newly imported tables manually.
This is the line that changed in my setup:
Code language: PHP (php)
$table_prefix = 'shop_en_';
The prefix in the copy became
What I didn’t know: there are options in the database that have the prefix hardcoded.
First, there was the option with the name
shop_en_user_roles in the
_options table. Easy Digital Downloads also has a few options using that prefix.
Then there are a lot more options per user using the table prefix in the
The solution: manually editing the entries
I ended up changing all the entries manually. On a larger site, I would have written an
UPDATE query to run through all of them automatically, but that wasn’t needed here.
As soon as I adjusted the table prefix in all option names and meta keys, my user account had full access to WP ADMIN again.