[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
Fri Jan 7 18:24:25 UTC 2011


#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:  closed
 Priority:  normal          |   Milestone:  3.1
Component:  Administration  |     Version:  3.1
 Severity:  normal          |  Resolution:  fixed
 Keywords:  has-patch       |
----------------------------+---------------------
Changes (by kpdesign):

 * cc: kpdesign (added)


Comment:

 In a convo with Andrew Nacin on Twitter a couple of days ago, I asked if
 removing child items was not possible (based on comment 6 to this ticket).
 He said that the final patch took that into consideration and that child
 items should be able to be removed.

 Using the following code to remove the dashboard links in the admin bar in
 Multisite:

 {{{
 function remove_admin_bar_dashboard_link() {
         global $current_user, $wp_admin_bar;

         if (!current_user_can('edit_posts') && is_admin_bar_showing()) {
                 $wp_admin_bar->remove_menu('dashboard');
         }
 }

 add_action('admin_bar_menu', 'remove_admin_bar_dashboard_link', 100);
 }}}

 This results in the dashboard link in the My Account menu being removed,
 but it does not remove the My Sites/[Site Name]/Dashboard links (see
 attached screenshot).

 My understanding of the remove_menu() function is that it looks for the
 slug for the menu item. Wouldn't the slug for all of the Dashboard links
 in the admin bar be 'dashboard' and thus removable using the above code?

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


More information about the wp-trac mailing list