0

I have an issue with WordPress. I have the below code and I am getting into the admin menu:

    public  function Create_Menu()
        {
         add_menu_page("demoset", "Demoset", 'manage_options', "demoset", array( $this ,"MenuFunction"), '', 6);
         add_submenu_page("demoset", "All Tables", "All Tables", 'manage_options', "demoset", array( $this ,"MenuFunction"));
         add_submenu_page("demoset", "Create Tables", "Create Tables", 'manage_options', "demolist", array( $this ,"Submenu_Function"));
        }
    
    public  function MenuFunction()
    {
        require_once ADMIN_VIEWS_PATH . 'view-dashboard.php';
    }
    
    public  function Submenu_Function()
    {
        require_once ADMIN_VIEWS_PATH . 'view-create.php';
    }
    
    public  function Edit_Function()
    {
        require_once ADMIN_VIEWS_PATH . 'view-edit.php';
    }

I can access my pages using below links:

  • http://localhost:8080/wordpress/wp-admin/admin.php?page=demoset
  • http://localhost:8080/wordpress/wp-admin/admin.php?page=demolist

Now, My issue is, I have to use the below link and I have to call the Edit_Function but I don't want to use the add_submenu_page. Any idea how to use it?

http://localhost:8080/wordpress/wp-admin/admin.php?page=demoedit

4
  • 1
    you can't access WP Admin as a logged out user, do you actually need to access that URL, or do you just need to display view-edit.php to logged out users somewhere on your site? Because you could display it somewhere that is not WP Admin, which would solve your problem, but it wouldn't answer your question. This looks like an X Y problem, where you asked how to implement your solution, instead of how to solve the original problem
    – Tom J Nowell
    Jan 2, 2023 at 17:25
  • @TomJNowell, No, Only logged-in users can access the page view-edit.php. My issue is, how can I access Edit_Function()? The edit function is not a part of the menu. I have added some data in Submenu_Function(). Now if the user wants to edit the records then I have to call the Edit_Function(). Jan 3, 2023 at 5:08
  • that doesn't make sense, you said in your question title how to do it without registering in WordPress, can you edit your question so that it is clearer and makes more sense? Start with your goal of allowing users to edit records on the frontend. What you've written doesn't make sense or translate well into english
    – Tom J Nowell
    Jan 3, 2023 at 15:22
  • @TomJNowell, Apologies for my bad English, My main aim is to access the Edit_Function (). would you help me out with this issue? Jan 5, 2023 at 10:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.