[wp-hackers] add_submenu_page() with no parent
Pascal Birchler
pascal.birchler at gmail.com
Tue Aug 13 13:47:39 UTC 2013
Looks like an error in the Codex to me, since this isn't documented in
the function
definition<http://core.trac.wordpress.org/browser/tags/3.6/wp-admin/includes/plugin.php#L980>.
I don't know if this was possible earlier, though. Maybe someone else knows
more about this function's history?
2013/8/13 Jonathan Brinley <jonathanbrinley at gmail.com>
> 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
>
>
> --
> Jonathan M. Brinley
>
> jonathanbrinley at gmail.com
> http://xplus3.net/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list