Another solution for WordPress’ “You do not have sufficient permissions to access this page.”

Many WordPress users have run in to the error “You do not have sufficient permissions to access this page.”

Sometimes, it is because you changed the table prefix and the solution is a database change.

For other folks, it was due to old plugin incompatibility. To fix it, you need to replace admin_head with admin_menu.

Unfortunately, neither solution worked for me. However, the latter (and some digging) pointed me in the right direction.

In my case, I had to change the parameters to—and order of—the add_submenu_page() and add_menu_page() calls.

Here’s the old code:

function thgs_add_menus() {
 add_submenu_page(__FILE__, "Heather Gold Show", "Shows", 8, "thgs/shows.php");
 add_submenu_page(__FILE__, "Heather Gold Show", "Venues", 8, "thgs/venues.php");
 add_menu_page('Show Management', 'Shows', 8, __FILE__);
}

And here’s the fix, which works with WP 2.8.4:

function thgs_add_menus() {
  add_menu_page('Show Management', 'THGS', "administrator", "thgs/shows.php");
  add_submenu_page("thgs/shows.php", "Manage Shows", "Shows", "administrator", "thgs/shows.php");
  add_submenu_page("thgs/shows.php", "Manage Venues", "Venues", "administrator", "thgs/venues.php");
} 

Leave a comment

Your email address will not be published. Required fields are marked *