You appear to be a bot. Output may be restricted
Description
Return the attached hooksReduce the $wp_filter[ $tag ] structure to something a little easier to interpret e.g. For the "wp_default_styles" hook it will be
: 0 bw_trace_attached_hooks;1 : 10 wp_default_styles;1Note: We can't use foreach against $wp_filter[ $tag ] since this moves the current pointer to the end of the array and messes up further filter functions. We need to work on a copy. See http://php.net/manual/en/control-structures.foreach.php
Usage
$string = bw_trace_get_attached_hooks( $tag );
Parameters
- $tag
- ( string ) required – the action hook or filter
Returns
string the attached hook informationSource
File name: oik-bwtrace/includes/bwtrace-actions.phpLines:
1 to 34 of 34
function bw_trace_get_attached_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; 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; } //bw_trace2( $hooks, "hooks", true, BW_TRACE_ALWAYS ); return( $hooks ); }View on GitHub View on Trac