From 9a3c0e39d441c31bbfa6c3c4941e0b892f6c9fb6 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 30 Dec 2010 19:04:32 +0000 Subject: [PATCH] Clean up admin bar node removal. Make it PHP4 safe and prevent display of blank spots. Props sorich87, SergeyBiryukov. fixes #16005 git-svn-id: https://develop.svn.wordpress.org/trunk@17184 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/class-wp-admin-bar.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/class-wp-admin-bar.php b/wp-includes/class-wp-admin-bar.php index dab409f905..1ede11e590 100644 --- a/wp-includes/class-wp-admin-bar.php +++ b/wp-includes/class-wp-admin-bar.php @@ -190,12 +190,12 @@ class WP_Admin_Bar { } function remove_node( $id, &$menu ) { - foreach( $menu as $menu_item_id => &$menu_item ) { - if ( $menu_item_id == $id ) { - $menu_item = null; - return true; - } + if ( isset( $menu->$id ) ) { + unset( $menu->$id ); + return true; + } + foreach( $menu as $menu_item_id => $menu_item ) { if ( ! empty( $menu->{$menu_item_id}['children'] ) ) $this->remove_node( $id, $menu->{$menu_item_id}['children'] ); }