[wp-trac] [WordPress Trac] #17585: Function remove_menu_page() makes an error message
WordPress Trac
wp-trac at lists.automattic.com
Fri May 27 07:20:11 UTC 2011
#17585: Function remove_menu_page() makes an error message
-------------------------------+------------------------------
Reporter: Surbma | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 3.1.3
Severity: normal | Resolution:
Keywords: reporter-feedback |
-------------------------------+------------------------------
Changes (by nacin):
* keywords: => reporter-feedback
Comment:
I don't think this is an issue with 3.1.3 vs 3.1.2. Rather, you're calling
remove_menu_page() before $menu is actually set up, or it seems in cases
when $menu is never set up. You need to wait for the admin_menu hook to
actually call remove_menu_page(). If you're doing it on admin_init, then
you're using the wrong hook, and that's why it's borking on AJAX requests.
We *could* do some poka-yoke there, by returning false if $menu isn't set.
But I'd rather it fail that way plugins know they're doing something
wrong.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17585#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list