Search code examples
phpwordpresspluginssubmenu

Getting an error when accessing a submenu page which i've created in wordpress


I've created a submenu page in wordpress, when I'm accessing it, the following error occurs:

Sorry you are not allowed to access the page.

I've already tried changing permissions and WP_DEBUG, but that doesn't solve the issue.

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

function b2b_user_management(){
  add_submenu_page('b2b_user_management','B2B User Management', 'B2B User Management','edit_themes','b2b_user_management','b2b_user_management_function');
}

function b2b_user_management_function(){
    include('managing_user.php');
}

How can I write the code, so I can access the page?


Solution

  • Replace this

    function b2b_user_management_function(){
           echo "Helllo";
        }
    

    and access page by below link

    http://your-website-url/wp-admin/admin.php?page=b2b_user_management