Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I just want to hide a page but I want to access it by directly entering its url. But I am unable to access that page after remove_submenu_page() function. I get this error: You do not have sufficient permissions to access this page.

Here is the code:

add_action("admin_menu", function(){    
    add_menu_page("PG", "PG", "manage_options", "epaper", function(){
        echo "sdsds'";        
    }, null, 3);
    add_submenu_page("epaper", "dsds", "dsds", "manage_options", "x", function(){
        echo "dds";
    },null,3);
     remove_submenu_page("epaper", "x");
});

I am unable to access /wp-admin/admin.php?page=x

However if I remove the function remove_submenu_page then again it opens. But shows in admin dashboard menu. I just want to hide it from dashboard menu.

Please tell me how can I hide any submenu item from dashboard menu but still have access to it from direct url.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.