#19937 closed defect (bug) (invalid)
'remove_menu_page' causes a Warning when 'Edit Image'
| Reported by: | carlos_a_sanz | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Media | Version: | 3.3.1 |
| Severity: | normal | Keywords: | close |
| Cc: | Focuses: |
Description
Calling remove_menu_page function on a admin_init hook causes this warning:
Warning: Invalid argument supplied for foreach() in /users/knut/workspace/adlerfresneda.com/htdocs/dev/wp-admin/includes/plugin.php on line 1261
This occurs when [Edit Image] has tightened on Media section and MediaUpload popup, therfore, the image for editing does not load.
Change History (5)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Admin menu functions such as add_menu_page(), add_submenu_page(), remove_menu_page(), and remove_submenu_page(), need to happen on the
admin_menuhook, not theadmin_inithook.The admin_init hook fires in some situations where there is no UI for which a menu will be built -- for example, the media popup, or admin-ajax.