[wp-trac] [WordPress Trac] #16005: When trying to remove an item from the admin bar, a blank spot is added in lieu of it

WordPress Trac wp-trac at lists.automattic.com
Tue Dec 28 08:47:51 UTC 2010


#16005: When trying to remove an item from the admin bar, a blank spot is added in
lieu of it
-----------------------------------+------------------
 Reporter:  sorich87               |       Owner:
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  3.1
Component:  Administration         |     Version:  3.1
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------
Changes (by sorich87):

 * keywords:   => has-patch 2nd-opinion


Comment:

 The attached patch fixes the issue, but I am not sure it is the best way
 to do it.

 The error is due to the fact that when remove_node() is called by
 remove_menu(), it returns an empty menu item (line 200 wp-includes/class-
 wp-admin-bar.php): $menu_item = null;.

 The attached patch prevent render() from returning anything when the menu
 item is null.

 Another way to fix the issue would be to unset the menu item in
 remove_node() instead of returning null. I tried:
 unset($menu->{$menu_item_id}) but it worked only for parent items. I am
 not sure about how to do the same for childs.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16005#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list