Display all hooks that run on your page

Add the following to your functions.php to display a sequential list of all actions that run on the page you’re viewing.

1
2
3
4
5
6
7
8
9
$debug_tags = array();
add_action( 'all', function ( $tag ) {
    global $debug_tags;
    if ( in_array( $tag, $debug_tags ) ) {
        return;
    }
    echo "<pre>" . $tag . "</pre>";
    $debug_tags[] = $tag;
} );

I find this a real life saver when tracing down bugs that are caused by/in actions/hooks.

That’s really all you need. Some blogposts are a lot shorter than others, but I guess that’s fine