[wp-trac] Re: [WordPress Trac] #5232: Get the current action and current filter name

WordPress Trac wp-trac at lists.automattic.com
Thu Oct 25 03:43:20 GMT 2007

#5232: Get the current action and current filter name
 Reporter:  tellyworth   |        Owner:  anonymous
     Type:  enhancement  |       Status:  new      
 Priority:  normal       |    Milestone:  2.4      
Component:  General      |      Version:           
 Severity:  normal       |   Resolution:           
 Keywords:  has-patch    |  
Comment (by tellyworth):

 I wrote a few draft patches for this yesterday, and after reviewing those
 I came to two conclusions:

 1. The filter/action code is time critical.  Anything that adds an extra
 function call, object dereference or similar can have a significant impact
 on performance.

 2. Properly encapsulating the current_filter data requires a singleton
 object; a function with a static variable is messy and involves several
 branches and function calls (which affect performance).  Short of
 refactoring the filter/action API, I can't see a good way to overcome

 wp-current-filter-revised-r6278.patch is a compromise.  It uses only one
 global, and provides a current_filter() API function for fetching the
 filter or action name.  Only 2 lines of code are needed in each of the
 time critical functions, with no branching or user function calls.

Ticket URL: <http://trac.wordpress.org/ticket/5232#comment:9>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list