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 am currently using add_submenu_page to add pages for my plugin. However, I wish to create a page that don't appear in the admin menu, is that possible?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

Set the parent_slug property to null, example;

   add_submenu_page( 
          null            // -> Set to null - will hide menu link
        , 'Page Title'    // -> Page Title
        , 'Menu Title'    // -> Title that would otherwise appear in the menu
        , 'administrator' // -> Capability level
        , 'menu_handle'   // -> Still accessible via admin.php?page=menu_handle
        , 'page_callback' // -> To render the page
    );

This will hide the sub menu page from your parent (top level) menu link.

It does not state this in the Codex entry for add_submenu_page though.

It now states this in the Codex entry for add_submenu_page (thanks goto Ian Dunn).

share|improve this answer
1  
It does now :) It only takes a minute to update it. –  Ian Dunn Sep 15 '12 at 9:20
    
Good lad, thanks. I was trying to do that but having trouble with log-in. –  userabuser Sep 15 '12 at 9:44
1  
You can also set the parent page to options.php to achieve the same effect. –  Pippin Sep 15 '12 at 19:55
    
Thanks @Pippin, I've also added that to the Codex with example code. –  userabuser Sep 15 '12 at 20:25

Your Answer

 
discard

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

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