WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#35556 closed enhancement (duplicate)

add_action accept array as first argument

Reported by: madeinua Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Plugins Keywords:
Focuses: Cc:
PR Number:

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
4 years ago

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

Duplicate of #14280.

#2 @SergeyBiryukov
4 years ago

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