Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm about to create a very simple logging plugin.

Every time an action or filter is fired I need to log it to the file. The idea is that we will be able to see exactly which actions and filters are executed (and functions they run) for every page load. This includes the order that they run in.

share|improve this question
2  
You might want to check out the Debug Bar Actions and Filters Addon (wordpress.org/plugins/debug-bar-actions-and-filters-addon) to see how they handle it. –  sabreuse Sep 25 '13 at 13:33
add comment

1 Answer

up vote 1 down vote accepted

The callbacks hooked onto 'all' are called prior to the callbacks for any hook (action and filters) being called. (See source)

add_action( 'all', 'wpse115617_all_hooks' );

function wpse115617_all_hooks(){
   //This is called for every filter & action

   //You can get the current hook to which it belongs with:
   $hook = current_filter();

}

See http://queryposts.com/function/current_filter/

share|improve this answer
    
thank you very much, Stephen! –  Alex Herrmann Sep 25 '13 at 14:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.