Clean up admin bar node removal. Make it PHP4 safe and prevent display of blank spots. Props sorich87, SergeyBiryukov. fixes #16005
git-svn-id: http://svn.automattic.com/wordpress/trunk@17184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ade413d098
commit
d0a0c31b1f
|
@ -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'] );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue