Find All Functions Attached to WordPress Filter & Action Hooks

Discover exactly what functions are attached to any WordPress hook, in the order they fire.

  • The post shares a helper function, print_filters_for(), that reveals which functions are attached to any given WordPress hook.
  • It helps you understand how WordPress core, themes, and plugins modify your site through add_action() and add_filter().
  • The function reads from the global $wp_filter array and prints the registered callbacks for the hook you specify.
  • Built-in error handling returns a WP_Error if no hook name is provided or if the hook doesn't exist.
  • Usage is simple: call print_filters_for('the_content') to list everything attached to that hook.
  • Output appears in a collapsible block, showing callbacks grouped by priority (e.g., wpautop, wptexturize, do_shortcode) along with their accepted argument counts.
  • It's a useful debugging tool for tracking down what is affecting your content or other hook-driven output.

Quite often I encounter situations where it’s useful to know what functions are affecting a particular WordPress hook. It really helps me understand the ways that WordPress core, themes and plugins affect my site, specifically through the use of add_action() and add_filter(). This handy function make’s it pretty easy to discover what functions are attached to a given WordPress hook.

/**
 * Print Filters For
 *
 * Discover what functions are attached to a given hook in WordPress.
 */
function print_filters_for( $hook = null ) {
    global $wp_filter;

    // Error handling
    if ( !$hook )
        return new WP_Error( 'no_hook_provided', __("You didn't provide a hook.") );
    if ( !isset( $wp_filter[$hook] ) )
        return new WP_Error( 'hook_doesnt_exist', __("$hook doesn't exist.") );

    // Display output
    echo '<details closed>';
    echo "<summary>Hook summary: <code>$hook</code></summary>";
    echo '<pre style="text-align:left; font-size:11px;">';
    print_r( $wp_filter[$hook] );
    echo '</pre>';
    echo '</details>';
}

Usage

// Find all functions attached to 'the_content'
print_filters_for('the_content');

This will output the results into your environment like this:

<details closed>
    <summary>Hook summary: <code>the_content</code></summary>
    <pre style="text-align:left; font-size:11px;">
    Array
    (
        [11] => Array
            (
                [capital_P_dangit] => Array
                    (
                        [function] => capital_P_dangit
                        [accepted_args] => 1
                    )

                [do_shortcode] => Array
                    (
                        [function] => do_shortcode
                        [accepted_args] => 1
                    )

            )

        [10] => Array
            (
                [wptexturize] => Array
                    (
                        [function] => wptexturize
                        [accepted_args] => 1
                    )

                [convert_smilies] => Array
                    (
                        [function] => convert_smilies
                        [accepted_args] => 1
                    )

                [convert_chars] => Array
                    (
                        [function] => convert_chars
                        [accepted_args] => 1
                    )

                [wpautop] => Array
                    (
                        [function] => wpautop
                        [accepted_args] => 1
                    )

                [shortcode_unautop] => Array
                    (
                        [function] => shortcode_unautop
                        [accepted_args] => 1
                    )

                [prepend_attachment] => Array
                    (
                        [function] => prepend_attachment
                        [accepted_args] => 1
                    )

            )
    )
    </pre>
</details>

I’ve been using this myself for a while, hopefully someone else out there will find it useful.

Resume