Support » Fixing WordPress » Register an admin page, but don't show it on any menu

  • Hey all,

    I’m trying to register an admin page, but I don’t want it to appear in any menus. Is there a function (or a way of manipulating one of the existing add_xxx_page() functions) to do this?


Viewing 4 replies - 1 through 4 (of 4 total)
  • I’ve not tried it but what about initially adding the page item as per usual and then hiding it in the menu using CSS?

    Nevermind, as is oftern the way, I stumbled across the answer as soon as I stopped looking!

    Thanks for the suggestion though Esmi.

    $this->pagehook = add_submenu_page(
        __('Edit Chart'),
        __('Edit Chart'),
        array(&$this, 'on_show_page')

    Explained in the second example in the codex for add_submenu_page().

    Ok, so the above code does through up an error –

    When checking user_can_access_admin_page(), because options.php is not a key in the global $admin_page_hooks, the page type is set wrongly as admin, not settings. This causes WP to tell me that I do not have permission to edit the page, when I clearly do.

    I’d ideally not like to go down the CSS route, but I will look in to that for now.

    If anyone has any other suggestions, I’d be greatful.


    Hey duck__boy,
    The solution at works great.

    Basically they recommend using the add_submenu_page() function with a NULL value for the $parent_slug parameter.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Register an admin page, but don't show it on any menu’ is closed to new replies.