Jonathan Brinley
2013-08-13 12:53:51 UTC
According to the codex (
http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters)
you can call add_submenu_page() with NULL or options.php as the parent to
create an admin page that doesn't appear in the admin menu. options.php
does, indeed, work for this, and NULL seems to work on multisite, but not
single site installs.
On a single site install, the permissions check
in user_can_access_admin_page() gets the incorrect page hook name when it
calls get_plugin_page_hookname(). A page registered with a NULL parent gets
the hook "dashboard_page_*", but get_plugin_page_hookname() returns
"admin_page_*". On multisite, it correctly returns "dashboard_page_*".
So, finally, to my question: is this a bug in the documentation, or a bug
in the code? It looks like NULL is unpredictable, and options.php is the
only safe way to register an orphan admin page.
Have a nice day,
Jonathan
http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters)
you can call add_submenu_page() with NULL or options.php as the parent to
create an admin page that doesn't appear in the admin menu. options.php
does, indeed, work for this, and NULL seems to work on multisite, but not
single site installs.
On a single site install, the permissions check
in user_can_access_admin_page() gets the incorrect page hook name when it
calls get_plugin_page_hookname(). A page registered with a NULL parent gets
the hook "dashboard_page_*", but get_plugin_page_hookname() returns
"admin_page_*". On multisite, it correctly returns "dashboard_page_*".
So, finally, to my question: is this a bug in the documentation, or a bug
in the code? It looks like NULL is unpredictable, and options.php is the
only safe way to register an orphan admin page.
Have a nice day,
Jonathan
--
Jonathan M. Brinley
***@gmail.com
http://xplus3.net/
Jonathan M. Brinley
***@gmail.com
http://xplus3.net/