Support » Fixing WordPress » Sorry, you are not allowed to access this page

Viewing 15 replies - 1 through 15 (of 20 total)
  • Typically, this error occurs as a result of a security or permissions issue. This error can often be resolved by:

    • If you have a backup file, you could always revert your site to the pre-error state
    • Use WP_Debug to get a list of errors and see if anything stands out
    • Review your server’s access and error log and see if anything stands out
    • Double check your file permissions
    • Deactivate themes and plugins. You already tried this
    • Manually reset your .htaccess file. You already tried this
    • Upgrade PHP to latest version
    • Double check your site is using the correct database prefix

    Unfortunately I don’t have a db backup before the issue occurred. The backup db I am using tables from for testing is from a clean/fresh install.

    I’ve enabled debugging and don’t get any errors.

    It must be something to do with the options table since it works when I replace that table with a “fresh” one.

    Thx!

    If replacing the tables seems to work, you could also try migrating the site files and database to a fresh WordPress install to see if that circumvents the issue.

    Ok after countless hours of examining wp_options tables in phpmyadmin I finally discovered the problem. Somehow the wp_user_role row got deleted. It can also happen if it is edited/changed by a plugin such as WooCommerce.

    So to fix it I copied the following from a fresh install and inserted it into the wp_options table with phpmyadmin:
    Remember to replace ‘wp_’ with your db prefix.

    option_name
    wp_user_role

    option_value
    a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:61:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:11:"update_core";b:1;s:10:"list_users";b:1;s:12:"remove_users";b:1;s:13:"promote_users";b:1;s:18:"edit_theme_options";b:1;s:13:"delete_themes";b:1;s:6:"export";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}

    Correction:
    I just realized that there was a typo above and this forum doesn’t allow edits after a few hours.

    The correct option_name is wp_user_roles not wp_user_role.

    option_name
    wp_user_roles

    option_value
    a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:61:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:11:"update_core";b:1;s:10:"list_users";b:1;s:12:"remove_users";b:1;s:13:"promote_users";b:1;s:18:"edit_theme_options";b:1;s:13:"delete_themes";b:1;s:6:"export";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}

    More info: https://www.sitepoint.com/mastering-wordpress-roles-and-capabilities/

    • This reply was modified 1 year, 11 months ago by padreed123.

    oh my god after 8 hours of debugging and trying everything on every site, finding nobody has a concrete solution and same standard wordpress debugging, you are my saviour. I found my wp_user_roles but it had been modified by some plugin with only like 3 roles. copied and pasted your code above and problem solved. Wish I had found this earlier and hope people find it in the future. This should be stickied somewhere. Once again Thank you.

    THE REAL SOLUTION TO: SORRY YOU ARE NOT ALLOWED TO ACCESS THIS PAGE.

    This worked for me, thanks!

    @padreed123
    I also encountered this problem and solved it with your tutorial. Thank you very much.

    Ela

    (@nellimeladze)

    Hi Padreed 123, we copied the code but it didn’t work for us. Could you please explain what you mean by (Remember to replace ‘wp_’ with your db prefix.)
    we tried to search that in the code but couldn’t find wp or db lettering

    where do we find this?

    please help:)
    thank you

    pallabba

    (@pallabba)

    Oh my god.You are genius.i was struggling since last 8 hours..but this solved it.
    Thank you So much

    @padreed123 Thank you for the solution, It worked for me.

    OMG @padreed123 you are an f’n SAVIOR!! In my case it was an Event Calendar that re-wrote that option. THANK YOU THANK YOU THANK YOU!!

    As a clarification, I don’t have a problem signing in to my site using my admin login. I have accessed the site using my admin name and password and been granted access with all of the editing options available to me. And, I can go to my forum without the “Sorry . . . page” message.

    However, when any “non admin” person signs into my site, they are not allowed to go to the forum and they do see the “Sorry . . . page” message.

    In my SQL database, “wp_user_options” page, the ”option_name” column does not include a “wp_user_roles” or “user_roles” option_name. There are 11 pages of option_names and none of them contain the words “user_roles” or even the word “roles”.

    Q1 – Am I looking in the wrong place for “user_roles”?

    In the “option_name” column, there is a “users_can_register” option_name with an “option_value” of “1”.

    Q2 – Is this “1” restricting the access by any registered users beyond me (assuming admin is “1”)? And, was there some place in settings for me to set the number of authorized users to a number other than “1”? What happens if I change the value to 1000?

    I read in a comment, above, that WooCommerce might have modified or deleted “user_roles”, and wondered if my plugin provider, Implecode, might have done the same thing for their “ecommerce catalog for WP” plugin, which I employ. I am reluctant to re-insert the “user_roles” name and its “value” without Implecode’s blessing.

    NOTE: I have asked Implecode, through a support ticket, if they removed the “user_role” row and associated “Value” from the database, and if re-inserting it will cause a problem.

    Q3 – So, assuming it is not an issue for Implecode, do I just go to the “insert” tab on the top of the “wp_user_options” database page and input the option_name “user_roles” or” wp_user_roles”, and the option_value per the @padreed123 recommendation above?

    Your suggestions are sincerely appreciated.

    I just spent two days trying to fix this issue and sending I don’t know how many smoke messages up for help. I did your process and first try success. 10 mins to read notes twice. 5 minutes to copy into phpMyAdmin. 15 minutes to have priceless success. THANK YOU.

    I’ll add my thanks here, too! I finally discovered a plugin Loco Translate had replaced the user_options entry in the DB. Crazy stuff, and I was about to give up.

Viewing 15 replies - 1 through 15 (of 20 total)
  • You must be logged in to reply to this topic.