Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#15723 closed feature request (fixed)

admin_bar_menu Hook Pass Back Admin Bar Instance

Reported by: TheDeadMedic Owned by:
Milestone: 3.1 Priority: normal
Severity: minor Version: 3.1
Component: Menus Keywords: has-patch
Focuses: Cc:


Would it not be handy to pass back the instance $wp_admin_bar in the do_action() call, if anything to save a lot of global calls?

do_action_ref_array( 'admin_bar_menu', array(&$wp_admin_bar) );

Attachments (1)

15723.diff (415 bytes) - added by JohnPBloch 7 years ago.

Download all attachments as: .zip

Change History (5)

#1 @nacin
7 years ago

  • Milestone changed from Awaiting Review to 3.1

#2 @nacin
7 years ago

Would this still work if the callback doesn't take an arg?

7 years ago

#3 @JohnPBloch
7 years ago

  • Keywords has-patch added

Using do_action_ref_array() as TheDeadMedic suggested works fine. If the callback doesn't take an argument this will still work (and the object will still be accessible by using func_get_args()).

#4 @ryan
7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [16957]) Pass wp_admin_bar object to admin_bar_menu action. Props TheDeadMedic, JohnPBloch. fixes #15723

Note: See TracTickets for help on using tickets.