[wp-trac] [WordPress Trac] #14280: add_filter should accept an array of tags

WordPress Trac wp-trac at lists.automattic.com
Wed Aug 15 17:16:36 UTC 2012


#14280: add_filter should accept an array of tags
-------------------------------------------------+-------------------------
 Reporter:  sivel                                |       Owner:
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:
Component:  Plugins                              |     Version:
 Severity:  normal                               |  Resolution:  wontfix
 Keywords:  has-patch early needs-testing dev-   |
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by nacin):

 PHP is not JavaScript, but even in JS, you assign these things to
 variables when it makes sense to do so. Closures are nice for one-off
 things. This is no longer so simple once you require adding it to multiple
 hooks. Why not a top-level function?

 Also of note, if you do use a closure but don't assign it to an accessible
 variable, it becomes impossible to remove that action later without
 calling remove_all_actions(). That is lame, and makes closures little
 suited beyond testing and internal implementations. For distributed work,
 they are best avoided.

 I don't have a specific objection to this, and PHP 5.4 [ ] syntax makes it
 somewhat elegant. But it does complicate an API that is, at the moment,
 quite simple.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14280#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list