Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#35556 closed enhancement (duplicate)

add_action accept array as first argument

Reported by: madeinua's profile madeinua Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Plugins Keywords:
Focuses: Cc:

Description

Would be a great possibility to allow accept first argument of the function add_action as array:

Instead of this:

add_action('action_1', 'myfunc');
add_action('action_2', 'myfunc');
add_action('action_3', 'myfunc');

have this:

add_action(['action_1', 'action_2', 'action_3'], 'myfunc');

Of course foreach() also can be solution for this case but this option is more elegance.

Change History (2)

#1 @swissspidy
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #14280.

#2 @SergeyBiryukov
9 years ago

  • Component changed from General to Plugins
Note: See TracTickets for help on using tickets.