[wp-trac] [WordPress Trac] #18850: hidden admin page
WordPress Trac
noreply at wordpress.org
Wed Apr 16 03:04:36 UTC 2014
#18850: hidden admin page
----------------------------+------------------------------
Reporter: ibotty | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
----------------------------+------------------------------
Comment (by mordauk):
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() {
add_dashboard_page(
'Welcome'
'Welcome to My Plugin',
'manage_options',
'pw-my-slug',
'pw_render_my_welcome_page'
);
}
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/18850#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list