[wp-trac] [WordPress Trac] #46635: Improve identifying of non–trivial callbacks in hooks

WordPress Trac noreply at wordpress.org
Wed Apr 3 20:03:37 UTC 2019

#46635: Improve identifying of non–trivial callbacks in hooks
 Reporter:  Rarst        |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  coding-standards

Comment (by azaozz):

 Replying to [comment:13 schlessera]:
 > I really hope this is not what we will end up doing.

 Yeah, I'd hate doing it too but as PW 5.2 officially "opens up" the
 possibility for using closures in hooks, thinking we need to ... do
 something to at least warn (new) developers that they are breaking the
 existing API without realizing it...

 > Let people decide whether they want to have them (hooks) be removable or

 Having "enforced", non-removable, almost "hard-coded" actions and filters
 is something I think we should avoid at all costs!

 The hooks API is old, but is very fast and simple to work with. It was
 designed to be "open", i.e. core or any plugin can add or remove any hook.
 Breaking this principle now would be pretty bad decision.

Ticket URL: <https://core.trac.wordpress.org/ticket/46635#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list