I was working on a project where I had to find out all the registered filters that I was about to apply, so here’s a WordPress quickie for you! I found this out by inspecting the apply_filters function inside the plugin.php core file, and apparently there’s a $wp_filter global that contains them all in an associative array where keys are tags.
So by doing a print_r at a certain time in your theme or function, you’re able to find out the whole list, but you might as well filter to the hook that you’re looking for. As an example let’s take “comment_text” as the filter tag and list all it’s callbacks — i.e. let’s find out what filters are applied to the comment text before we print it out. Note that this has to run at a point where the filters have already been added, probably before a call to the comment_text() function.
global $wp_filter; print_r( $wp_filter['comment_text'] );
This may seem pretty useless at first sight, but did you know that the comment_text is passed through wptexturize, convert_chars, make_clickable, convert_smilies and several other filters? I didn’t, and I used this trick to find out, which lead me to the make_clickable function which I was looking for in the first place ;)
If you’re wondering what the array keys are in the array that you’ve printed, those are the priorities which were passed (or defaulted) when calling add_filter.
I hope this turns out to be useful to somebody, so thanks for retweeting!