[wp-trac] [WordPress Trac] #43714: remove_menu_page(): E_WARNING: Invalid argument supplied for foreach()
WordPress Trac
noreply at wordpress.org
Fri Apr 6 20:35:41 UTC 2018
#43714: remove_menu_page(): E_WARNING: Invalid argument supplied for foreach()
--------------------------+-----------------------------
Reporter: conner_bw | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: 4.9.5
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
`remove_menu_page()` sometimes logs: E_WARNING: Invalid argument supplied
for foreach()
Problematic code:
{{{
function remove_menu_page( $menu_slug ) {
global $menu;
foreach ( $menu as $i => $item ) {
// ...
}}}
URL /wp/wp-admin/admin-ajax.php
HTTP referrer https://_SOME_SITE_/wp/wp-admin/network/users.php
Stack trace
{{{
/vendor/soberwp/intervention/src/Module/RemoveMenuItems.php (121)
/web/wp/wp-includes/class-wp-hook.php (286)
/web/wp/wp-includes/class-wp-hook.php (310)
/web/wp/wp-includes/plugin.php (453)
/web/wp/wp-admin/admin-ajax.php (44)
}}}
Offending line:
https://github.com/soberwp/intervention/blob/7d69c58b32fce29aad08e4ff9c9de43963122610/src/Module/RemoveMenuItems.php#L121
Possible reason: `global $menu` not defined?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43714>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list