Opened 13 years ago
Closed 13 years ago
#21591 closed enhancement (duplicate)
Allow passing array of hook names to add_filter and add_action
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Plugins | Keywords: | |
| Focuses: | Cc: |
Description
One thing I wish I was able to do is pass multiple hooks to add_action() and add_filter(), so I could do stuff like this:
add_action( ["admin_print_styles-post.php", "admin_print_styles-post-new.php"], function() {
echo 'Two in one!';
} );
Currently If you want to use a closure you have to do something like
add_action( "admin_print_styles-post.php", $hook = function() {
echo 'Two in one!';
} );
add_action( "admin_print_styles-post-new.php", $hook );
Change History (1)
Note: See
TracTickets for help on using
tickets.
#14280