Menu Error in Admin Console with Custom Plugin: You do not have sufficient permissions to access this page

I think the issue may be in your call to add_submenu_page():

add_submenu_page('wpsc-sales-logs',...

The first parameter needs to be a reference to your Menu Page’s “slug”, i.e. if you use 'edit.php' instead you’ll see that you get a menu option under the “Posts” menu page:

add_submenu_page('edit.php','WPEC - Group Pricing','Group Pricing', 7,
                 'wp-e-commerce-group-pricing', 'price_options');

Here’s what it looks like:

WordPress Admin Menu with Submenu Page URL
(source: mikeschinkel.com)

So you need to find out what URL fragment (the part past http://yoursite.com/wp-admin/) that your menu page uses.

UPDATE

For future readers, Roland’s issue was a hook priority issue. Changing priority from 10 to 11 fixed it in his case:

add_action('admin_menu', 'add_options_gp',11);

P.S. You really don’t need the if statement testing for is_admin() since you are using the 'admin_menu' hook; it only fires in the admin.

Leave a Comment