[wp-hackers] add_submenu_page() with no parent
jdg at codesymphony.co
Tue Aug 13 16:30:06 UTC 2013
There are ways of doing this, but its currently not a "feature" of the function. See these tickets:
On Aug 13, 2013, at 9:47 AM, Pascal Birchler <pascal.birchler at gmail.com> wrote:
> Looks like an error in the Codex to me, since this isn't documented in
> the function
> 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 (
>> 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 M. Brinley
>> jonathanbrinley at gmail.com
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers