[wp-trac] [WordPress Trac] #38183: Add hooks to be run before and after each callback

WordPress Trac noreply at wordpress.org
Wed Sep 28 23:41:24 UTC 2016


#38183: Add hooks to be run before and after each callback
-------------------------+-------------------------------------------------
 Reporter:  pento        |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Future Release
Component:  Plugins      |    Version:
 Severity:  normal       |   Keywords:  needs-patch needs-unit-tests 2nd-
  Focuses:               |  opinion
-------------------------+-------------------------------------------------
 Since before the dawn of time, debugging tools have relied on the `all`
 hook to collect information about how long hooks take to run, and which
 callbacks are registered to that hook.

 This has a few drawbacks. Primarily, it's not possible to collect timing
 information about individual callbacks, and it's quite difficult to manage
 recursive hook behaviour.

 With that in mind, hooks that run before and after each callback would be
 quite valuable, but they do need to be considered carefully.

 * What kind of performance impact would they have? If there are no
 callbacks registered to these hooks, there should ideally be no
 performance impact.
 * Should they be `WP_DEBUG` only? This would discourage plugins from
 abusing them on production systems - they would only be used if the site
 admin explicitly sets the site to debugging mode.
 * Dealing with recursion is fun, should they provide any helpers for
 indicating recursion level, or is it up to the code hooking into them to
 handle that?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38183>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list