#23767 closed enhancement (wontfix)
remove_menu_page: Check for existing menu items
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.5 |
| Component: | Warnings/Notices | Keywords: | has-patch |
| Focuses: | Cc: |
Description
This error appears in my error log:
PHP Warning: Invalid argument supplied for foreach() in /www/htdocs/wp-admin/includes/plugin.php on line 1290
The if-empty patch is attached.
Attachments (1)
Change History (9)
Note: See
TracTickets for help on using
tickets.
Looks like there are only three ways to get this warning:
remove_menu_page()after the admin is fully loaded, but before$menuglobal is set up, e.g. by hooking intoauth_redirectaction instead ofadmin_menu, which goes against the Codex example: http://codex.wordpress.org/Function_Reference/remove_menu_page.remove_menu_page()on theadmin_inithook instead ofadmin_menu. As noted in #19937,admin_initfires in some situations where there is no UI for which a menu will be built.$menuglobal at some point.These are all developer errors, so the developer should see the warning.