1

I'm not able to visit plugin page in my admin panel. I have found some advices for debbuging this issue, but I wasn't able to find any solutions in mySQL, everything seems ok.

Does anyone has ideas that to do with it?

You do not have sufficient permissions to access this page. 

Array
(
[Pages No Access] => Array
    (
        [edit-tags.php?taxonomy=link_category] => 1
    )

[User Info] => WP_User Object
    (
        [data] => stdClass Object
            (
                [ID] => 1
                [user_login] => demo14
                [user_pass] => $P$Bu2vr91smpBRQHOFSxRAqZ3U5j06dA.
                [user_nicename] => demo14
                [user_email] => EMAILHERE
                [user_url] => 
                [user_registered] => 2014-11-15 23:16:37
                [user_activation_key] => 
                [user_status] => 0
                [display_name] => demo14
            )

        [ID] => 1
        [caps] => Array
            (
                [administrator] => 1
            )

        [cap_key] => wp_11capabilities
        [roles] => Array
            (
                [0] => administrator
            )

        [allcaps] => Array
            (
                [switch_themes] => 1
                [edit_themes] => 1
                [activate_plugins] => 1
                [edit_plugins] => 1
                [edit_users] => 1
                [edit_files] => 1
                [manage_options] => 1
                [moderate_comments] => 1
                [manage_categories] => 1
                [manage_links] => 1
                [upload_files] => 1
                [import] => 1
                [unfiltered_html] => 1
                [edit_posts] => 1
                [edit_others_posts] => 1
                [edit_published_posts] => 1
                [publish_posts] => 1
                [edit_pages] => 1
                [read] => 1
                [level_10] => 1
                [level_9] => 1
                [level_8] => 1
                [level_7] => 1
                [level_6] => 1
                [level_5] => 1
                [level_4] => 1
                [level_3] => 1
                [level_2] => 1
                [level_1] => 1
                [level_0] => 1
                [edit_others_pages] => 1
                [edit_published_pages] => 1
                [publish_pages] => 1
                [delete_pages] => 1
                [delete_others_pages] => 1
                [delete_published_pages] => 1
                [delete_posts] => 1
                [delete_others_posts] => 1
                [delete_published_posts] => 1
                [delete_private_posts] => 1
                [edit_private_posts] => 1
                [read_private_posts] => 1
                [delete_private_pages] => 1
                [edit_private_pages] => 1
                [read_private_pages] => 1
                [delete_users] => 1
                [create_users] => 1
                [unfiltered_upload] => 1
                [edit_dashboard] => 1
                [update_plugins] => 1
                [delete_plugins] => 1
                [install_plugins] => 1
                [update_themes] => 1
                [install_themes] => 1
                [update_core] => 1
                [list_users] => 1
                [remove_users] => 1
                [add_users] => 1
                [promote_users] => 1
                [edit_theme_options] => 1
                [delete_themes] => 1
                [export] => 1
                [administrator] => 1
            )

        [filter] => 
    )

[Roles] => Array
    (
        [administrator] => Administrator
        [editor] => Editor
        [author] => Author
        [contributor] => Contributor
        [subscriber] => Subscriber
    )

)

I suppose that problem could be in this place: [roles] => Array ( [0] => administrator ) But I haven't ideas from where it comes.

UPD:

after I have changed admin capabilities, I have other feedback:

You do not have sufficient permissions to access this page.

Array
(
[Pages No Access] => Array
    (
        [index.php] => 1
        [separator1] => 1
        [edit.php] => 1
        [upload.php] => 1
        [link-manager.php] => 1
        [edit.php?post_type=page] => 1
        [edit-comments.php] => 1
        [separator2] => 1
        [themes.php] => 1
        [plugins.php] => 1
        [profile.php] => 1
        [tools.php] => 1
        [options-general.php] => 1
        [separator-last] => 1
    )

[User Info] => WP_User Object
    (
        [data] => stdClass Object
            (
                [ID] => 1
                [user_login] => demo14
                [user_pass] => $P$BZw7yr3PW6qo/bhXq8E9MvPdzqeZjb1
                [user_nicename] => demo14
                [user_email] => EMAIL
                [user_url] => 
                [user_registered] => 2014-11-16 13:18:41
                [user_activation_key] => 
                [user_status] => 1
                [display_name] => demo14
            )

        [ID] => 1
        [caps] => Array
            (
            )

        [cap_key] => wp21_capabilities
        [roles] => Array
            (
            )

        [allcaps] => Array
            (
            )

        [filter] => 
    )

[Roles] => Array
    (
        [administrator] => Administrator
        [editor] => Editor
        [author] => Author
        [contributor] => Contributor
        [subscriber] => Subscriber
    )

   )
  • 1
    Which hook is being used to create the admin page? It should be admin_menu. Otherwise you will get that error. What is in the capability parameter for the creation of the admin page? – shanebp Nov 16 '14 at 14:43
2

According to the documentation for add_menu_page:

Note: If you're running into the "You do not have sufficient permissions to access this page" error, then you've hooked too early. The hook you should use is admin_menu.

This means you need to wrap your menu creation in something like:

add_action( 'admin_menu', function() {
    add_menu_page(
        // page title
        'Page Title',
        // menu title
        'My Menu Title,
        // capability
        'some_capability,
        // menu slug
        'my-page',
        // callback function
        'do_my_page_content'
    );
});
  • Thank you, Trii. It is good solution. I have posted question some time ago and no one have ideas about the trouble. – inno.vlad Jan 9 '15 at 16:37
  • I had the same issue today and came across this post while trying to solve it. I figured I'd reply with the answer that worked for me – Josh J Jan 9 '15 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.