Opened 8 years ago
Last modified 7 years ago
#38183 new enhancement
Add hooks to be run before and after each callback
Reported by: | pento | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Plugins | Keywords: | needs-patch needs-unit-tests 2nd-opinion |
Focuses: | Cc: |
Description
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?
Change History (3)
Note: See
TracTickets for help on using
tickets.
Most important, most necessary. Im debugging a wordpress/woocommerce install which has ~15 seconds time in init action. If we had something like this, it would be very easy to determine which of the 90~ callbacks hooked to init is causing slowness.