Getting a list of WordPress hook actions

January 18th, 2012 by Alex Leave a reply »

Sometimes content is outputted somewhere where I don’t need (when I run do_action), and I can’t really see what action does that. So to get the list of WordPress actions attached to a hook, use this kind of code:

global $wp_filter;
var_dump($wp_filter['comment_form']);

You will get then something like this:

array(1) {
  [10]=>
  array(2) {
    ["wp_comment_form_unfiltered_html_nonce"]=>
    array(2) {
      ["function"]=>
      string(37) "wp_comment_form_unfiltered_html_nonce"
      ["accepted_args"]=>
      int(1)
    }
    ["akismet_add_comment_nonce"]=>
    array(2) {
      ["function"]=>
      string(25) "akismet_add_comment_nonce"
      ["accepted_args"]=>
      int(1)
    }
  }
}

Pretty cool, now we know what produces all that output.


Comments are closed.