Opened 16 months ago
Closed 16 months ago
#19937 closed defect (bug) (invalid)
'remove_menu_page' causes a Warning when 'Edit Image'
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Media | Version: | 3.3.1 |
| Severity: | normal | Keywords: | close |
| Cc: |
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 (3)
comment:2
solarissmoke — 16 months ago
- Keywords close added
comment:3
SergeyBiryukov — 16 months ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.

Admin menu functions such as add_menu_page(), add_submenu_page(), remove_menu_page(), and remove_submenu_page(), need to happen on the admin_menu hook, not the admin_init hook.
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.