Make WordPress Core

Opened 6 years ago

Last modified 19 months ago

#18850 new enhancement

hidden admin page

Reported by: ibotty Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords:
Focuses: Cc:


it should be possible to create a hidden admin page.

this is useful for pages, that require parameters which are better inserted in other pages (e. g. using the post_row_actions filter).

if this is already possible, it should be documented somewhere where it might be found.

(btw: i'm not sure, what the difference between feature request and enhancement is. please redeclare as fit)

Change History (13)

#1 @jane
6 years ago

  • Keywords changed from admin page, hidden to admin page hidden
  • Type changed from enhancement to feature request

A hidden admin page? Hidden from who, and for what purpose?

#2 @ibotty
6 years ago

maybe i did not make myself very clear. sorry about it.

using the filter hook post_row_actions you can insert additional 'actions' into a post view. say you want to have a special 'post edit view'. you select the post in the post overview (the page with the WP_Posts_List_Table) and you link to your "hidden" page. this page does not make sense without a post-id and this post is only selected somewhere else. so this page should be accessible as if it were in wp-admin, but not be in the menu. (this page should behave similar to options.php in this regard.)

did i make myself clear now?

#3 @nacin
6 years ago

  • Type changed from feature request to enhancement

Makes sense, basically, options.php, as you said.

I'm willing to bet this is possible in the current API, only that it's clunky. Not even sure the approach I'd take to do it, but I imagine there are a few.

FWIW, custom post types do allow show_in_menu => false.

#4 @johnjamesjacoby
5 years ago

+1 to this. It would allow plugins to make Welcome/Credits pages similar to WordPress core, without needing to pollute the admin menu.

Last edited 5 years ago by johnjamesjacoby (previous) (diff)

#5 @SidHarrell
5 years ago

I found this: http://stackoverflow.com/questions/3902760/how-do-you-add-a-wordpress-admin-page-without-adding-it-to-the-menu

I used it like so:

public function register_page() {
		global $_registered_pages;

		$menu_slug = 'restaurant_category_editor';
		$hookname = get_plugin_page_hookname($menu_slug, '');
		if (!empty($hookname)) {
			add_action($hookname, array(&$this, 'render_edit_page'));
		$_registered_pages[$hookname] = true;

And when I browse to: http://chinadelight.info/wp-admin/admin.php?page=restaurant_category_editor
I get my "hello world!" output of the redering function.
should be easy enough to turn into a core function by moving the $menu_slug and the callback into the parameters.

#6 @SidHarrell
5 years ago

I made it more generic, so:

add_action('admin_menu', 'add_non_menu_pages');

function add_non_menu_pages() {
    global $_registered_pages;
    $pages = get_non_menu_pages();
    foreach ($pages as $menu_slug => $callback) {
                $hookname = get_plugin_page_hookname($menu_slug, '');
                if (!empty($hookname)) {
                        add_action($hookname, $callback);
                $_registered_pages[$hookname] = true;

function get_non_menu_pages() {
    return array(
        'pricing_editor' => 'render_edit_page'

function render_edit_page() {
    echo "hello world!";

#7 @SergeyBiryukov
5 years ago

  • Component changed from General to Administration
  • Keywords admin page hidden removed

Closed #20878 as a duplicate.

#8 @SergeyBiryukov
5 years ago

Closed #21424 as a duplicate.

#9 @joe.woidpress
5 years ago

Ah-ha. It seems I just made a duplicate of this request http://core.trac.wordpress.org/ticket/21424.

If you read my closed ticket, my hack to get this functionality was to create a submenu page of a submenu page (using add_submenu_page on something that was already a submenu).

This works well enough, but doesn't sit well with me. If we could get an official core function that does this it'd be great. (It'd also be cool if a submenu of a submenu kept the visible parent item open while the "hidden" page was being displayed.)

#10 @SergeyBiryukov
4 years ago

#25591 was marked as a duplicate.

#11 @mordauk
3 years ago

This can be done by creating a submenu of index.php and then removing it and then removing it during the admin_head action. For example:

function pw_my_hidden_admin_page() {
		'Welcome to My Plugin',
add_action( 'admin_menu', 'pw_my_hidden_admin_page' );

function pw_render_my_welcome_page() {
	echo 'Hello';

function pw_hide_my_welcome_page() {
	remove_submenu_page( 'index.php', 'pw-my-slug' );
add_action( 'admin_head'', 'pw_hide_my_welcome_page' );

It's a bit clunky but it does work.

I'd love to see a better approach.

#12 @SergeyBiryukov
3 years ago

#28700 was marked as a duplicate.

#13 @swissspidy
19 months ago

#34248 was marked as a duplicate.

Note: See TracTickets for help on using tickets.