[wp-trac] [WordPress Trac] #19380: There is no way to specify placement of a new menu item in the Admin Bar

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 28 16:23:24 UTC 2011


#19380: There is no way to specify placement of a new menu item in the Admin Bar
--------------------------+-----------------------------
 Reporter:  willshouse    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Admin Bar     |     Version:  3.3
 Severity:  minor         |  Resolution:
 Keywords:                |
--------------------------+-----------------------------

Comment (by willshouse):

 I agree, it does make sense to add priorities in a future release and not
 do it last minute on 3.3, especially if there is a workaround with the
 hooks as you mentioned.

 But can someone give an example of how to use the actions? I tried in 3.2
 and 3.3beta4 and was not successful. I tried the code on this page
 http://wordpress.stackexchange.com/questions/12502/ and also a modified
 version I created (included below). I can't seem to use these actions to
 remove the items or reorder them. What am I doing wrong here? Didn't see
 any WP documentation on this...

 {{{
 function admin_bar_test() {

  remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 );
  remove_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
  remove_action( 'admin_bar_menu', 'wp_admin_bar_dashboard_view_site_menu',
 25 );


  remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 );

  remove_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
  remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );

  remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
  remove_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu', 60 );

  remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
 }

 add_action( 'wp_before_admin_bar_render', 'admin_bar_test', 2 );
 }}}

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


More information about the wp-trac mailing list