2

When I try to visit my site http://www.diskdrivesolutions.com/wp-admin/ to login I get this error "You do not have sufficient permissions to access this page.".

So then I did some research online & found the code below to help debug what is going on. All I did was added the code below to my functions.php file.

<?php
    add_action('admin_page_access_denied', 'debug_page_access');

function debug_page_access() {
    global $pagenow;
    global $menu;
    global $submenu;
    global $_wp_menu_nopriv;
    global $_wp_submenu_nopriv;
    global $plugin_page;
    global $_registered_pages;

    $parent = get_admin_page_parent();
    $hookname = get_plugin_page_hookname($plugin_page, $parent);

    echo "Pagenow = " . $pagenow . "<br/>";
    echo "Parent = " . $parent . "<br/>";
    echo "Hookname = " . $hookname . "<br/>";

    echo "Menu = " . $menu . "<br/>";
    echo "Submenu = " . $submenu[$parent] . "<br/>";
    echo "Menu nopriv = " . $_wp_menu_nopriv . "<br/>";
    echo "Submenu nopriv = " . $_wp_submenu_nopriv[$parent][$plugin_page] . "<br/>";
    echo "Plugin page = " . $plugin_page . "<br/>";
    echo "Registered pages = " . $_registered_pages[$hookname] . "<br/>";

}
?>

Now when I visit http://www.diskdrivesolutions.com/wp-admin/ I get the error messages below.

Pagenow = index.php
Parent = 
Hookname = admin_page_
Menu = Array
Submenu = 
Menu nopriv = Array
Submenu nopriv = 
Plugin page = 
Registered pages = 
You do not have sufficient permissions to access this page.

Can someone please help me figure out what is going on? I really need to fix this as soon as possible.

user3707997
  • 21
  • 1
  • 1
  • 3

4 Answers4

9

Try below code

UPDATE `{%TABLE_PREFIX%}usermeta` SET `meta_key` = replace(`meta_key`, '{%OLD_TABLE_PREFIX%}', '{%NEW_TABLE_PREFIX%}');
UPDATE `{%TABLE_PREFIX%}options` SET `option_name` = replace(`option_name`, '{%OLD_TABLE_PREFIX%}', '{%NEW_TABLE_PREFIX%}');

For further detail You do not have sufficient permissions to access this page without any change

Community
  • 1
  • 1
Bikram Shrestha
  • 2,010
  • 24
  • 22
2

Here's the exact fix of this error, goto

PhpMyAdmin > [your database] > prefix_usermeta

Now search for prefix_user_level and prefix_capabilities rename these both to match your database prefix (same in lower case letters, probably).

Why it happens:

While installing wordpress you have mistakenly set your prefix in All CAPS or at least one Capital Letter. However when you export your database it automatically turns everything into smaller letters except those inside tables. So either you need to manually change those caps to small letters or change your prefix again to caps.

Santosh Kumar
  • 26,475
  • 20
  • 67
  • 118
rojoloco47
  • 61
  • 2
2

If its not a prefix issue, then try resetting the roles for WordPress to its defaults, I used the plugin 'Capability Manager Enhanced' to do just that and it worked like a charm :)

STRUCT
  • 66
  • 3
0

Remove the debug code and make sure all the folder permissions are set to 755 and all the file permissions are set to 644. If they are all correct and you're still getting the error, check your .htaccess file for any lockouts.

Alternatively, if neither of those options work, I would suggest disabling the plugins on the site and try to gain access again.

ERIC BARANOWSKI
  • 109
  • 1
  • 7