Plugin – create a page without it appearing in the side menu

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).

Leave a Comment