Description
Return the attached hooksNote: It's safe to use foreach over $wp_filter[ $tag ] since this routine's invoked for the 'all' hook not the hook in question. But I've copied the code for bw_trace_get_attached_hooks() anyway since it's more 'complete' See http://php.net/manual/en/control-structures.foreach.php
Usage
$string = genesistant_get_hooks( $tag );Parameters
- $tag
- ( string ) required – the action hook or filter
Returns
string the attached hook informationSource
File name: genesistant/genesistant.phpLines:
1 to 37 of 37
function genesistant_get_hooks( $tag ) { global $wp_filter; if ( isset( $wp_filter[ $tag ] ) ) { $current_hooks = $wp_filter[ $tag ]; //bw_trace2( $current_hooks, "current hooks for $tag", false, BW_TRACE_VERBOSE ); $hooks = null; $hooks = genesistant_current_filter(); $hooks .= "\n"; foreach ( $current_hooks as $priority => $functions ) { $hooks .= "\n: $priority "; foreach ( $functions as $index => $args ) { $hooks .= " "; if ( is_object( $args['function' ] ) ) { $object_name = get_class( $args['function'] ); $hooks .= $object_name; } elseif ( is_array( $args['function'] ) ) { //bw_trace2( $args, "args" ); if ( is_object( $args['function'][0] ) ) { $object_name = get_class( $args['function'][0] ); } else { $object_name = $args['function'][0]; } $hooks .= $object_name . '::' . $args['function'][1]; } else { $hooks .= $args['function']; } $hooks .= ";" . $args['accepted_args']; } } } else { $hooks = null; } return( $hooks ); }View on GitHub
