@bcworkz no worries and thanks for the explanation, nothing to harp on I was just curious to stumble across it and seeing that it could be a useful tool for debugging and maybe even mapping out every action and filter from cradle to grave which is definitely a handy tool to have in one’s bag of tricks.
I was able to do some nifty mapping such as:
/**
* Logging of all functions tied to a specific action hook
* i.e. print_filters_for( 'the_content' );
* shows all functions that fire for the_content
**/
function print_filters_for( $hook = '' ) {
global $wp_filter;
if ( empty( $hook ) || ! isset( $wp_filter[ $hook ] ) )
return;
$data = '<pre>';
$data .= print_r( $wp_filter[ $hook ], true );
$data .= '</pre>';
return $data;
}
add_action( 'all', create_function( '', 'write_log( print_filters_for( current_filter() ) );' ) );
-
This reply was modified 5 years, 1 month ago by
pingram.