[wp-trac] [WordPress Trac] #41728: Give us ability to debug WP Hooks (will be excellent for improvement)

WordPress Trac noreply at wordpress.org
Fri Aug 25 18:22:01 UTC 2017


#41728: Give us ability to debug WP Hooks (will be excellent for improvement)
-----------------------------+-----------------------------
 Reporter:  tazotodua        |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 I have seen some plugins that debug WP Hooks execution times (Query
 Monitor, Debug bar- slow actions), however, none of them does the
 following..

 I wanted that WP had a hook (for each added function), that should be
 fired before and after any HOOK-ed function. for example, XYZ theme/plugin
 adds its typical function with `add_action` or `add_filter`.

 Then we should have ability to create a function, that will be attached to
 all individual functions (which are hooked in "ANY" action or filter):

 {{{
 my_function_before_exec($function_name=false){
     $GLOBALS['my_exec_times'][$function_name]['start']= microtime();
 }

 my_function_after_exec($function_name=false){
     $GLOBALS['my_exec_times'][$function_name]['end']= microtime();
 }
 }}}


 so, WP should have something like that, within it's core, that could
 support/had filter, to be attached to any individual hook-ed function.

 that will be excellent to create a profiler plugin, that could find out
 the exectuion times for all functions, and we could easily detect heavy
 plugins/codes. That will be good for WP optimization.

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


More information about the wp-trac mailing list