Home » WordPress function to show all filters attached to a hook

WordPress function to show all filters attached to a hook


This is just a quick little code snippet for a function that will WordPress function to show all filters attached to a hook. All this will do is print out all the functions attached to the hook. This means that anything added with something like add_filter( ‘the_content’, ‘some_function’ ); would be able to be printed out in this list as some_function.

There may be some other uses for this that I don’t know about but I mainly just use this to get an idea for what is attached to a particular filter hook so I can quickly debug and see what tom foolery some guy’s plugin is hooking into.

Example usage:

This should then print out all the functions that have been hooked into the the_content filter. You can modify the way the markup spits out or have it return $wp_filter[ $hook ]; as well in the event that you don’t want it to just spit out all the function names onto the page. Since I typically just use this approach to quickly debug some things I didn’t really care too much about the output.

Let me know if you have any questions or comments. Thanks for reading 🙂

One comment on “WordPress function to show all filters attached to a hook

Leave a Reply

Your email address will not be published. Required fields are marked *