WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 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:

Description

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 3 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 nacin3 years ago

  • Milestone changed from Awaiting Review to 3.1

comment:2 nacin3 years ago

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

JohnPBloch3 years ago

comment:3 JohnPBloch3 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()).

comment:4 ryan3 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.