WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#19937 closed defect (bug) (invalid)

'remove_menu_page' causes a Warning when 'Edit Image'

Reported by: 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 (3)

#1 @nacin
6 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
6 years ago

  • Keywords close added

#3 @SergeyBiryukov
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.