#23767 closed enhancement (wontfix)
remove_menu_page: Check for existing menu items
| Reported by: | sergej.mueller | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Warnings/Notices | Version: | 3.5 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.