Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 4 years ago

#19937 closed defect (bug) (invalid)

'remove_menu_page' causes a Warning when 'Edit Image'

Reported by: carlos_a_sanz's profile carlos_a_sanz Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3.1
Component: Media Keywords: close
Focuses: 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 (5)

#1 @nacin
13 years ago

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.

#2 @solarissmoke
13 years ago

  • Keywords close added

#3 @SergeyBiryukov
13 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

#4 @SergeyBiryukov
4 years ago

#23767 was marked as a duplicate.

#5 @SergeyBiryukov
4 years ago

#43714 was marked as a duplicate.

Note: See TracTickets for help on using tickets.