Print all WordPress hooks

Ever needed to print out all the hooks in the sequence they are being called (for example to find a good hook to modify a particular behavior)?

add_filter( 'all', function( $tag ) {
	echo "apply_filters($tag)<br/>";
} );
add_action( 'all', function( $tag ) {
	echo "do_action($tag)<br/>";
} );

Is a quick and easy way to do this via a small modification in wp-settings.php (after plugin.php is included).

Posted in web