我自己用了一些不同的东西,但有一天我用了这个片段来改进我的钩子“spoofer”。
function list_hooks( $filter = false ){
global $wp_filter;
$hooks = $wp_filter;
ksort( $hooks );
foreach( $hooks as $tag => $hook )
if ( false === $filter || false !== strpos( $tag, $filter ) )
dump_hook($tag, $hook);
}
function list_live_hooks( $hook = false ) {
if ( false === $hook )
$hook = \'all\';
add_action( $hook, \'list_hook_details\', -1 );
}
function list_hook_details( $input = NULL ) {
global $wp_filter;
$tag = current_filter();
if( isset( $wp_filter[$tag] ) )
dump_hook( $tag, $wp_filter[$tag] );
return $input;
}
function dump_hook( $tag, $hook ) {
ksort($hook);
echo "<pre>>>>>>\\t<strong>$tag</strong><br />";
foreach( $hook as $priority => $functions ) {
echo $priority;
foreach( $functions as $function )
if( $function[\'function\'] != \'list_hook_details\' ) {
echo "\\t";
if( is_string( $function[\'function\'] ) )
echo $function[\'function\'];
elseif( is_string( $function[\'function\'][0] ) )
echo $function[\'function\'][0] . \' -> \' . $function[\'function\'][1];
elseif( is_object( $function[\'function\'][0] ) )
echo "(object) " . get_class( $function[\'function\'][0] ) . \' -> \' . $function[\'function\'][1];
else
print_r($function);
echo \' (\' . $function[\'accepted_args\'] . \') <br />\';
}
}
echo \'</pre>\';
}
如果有人写了这篇文章,请将自己命名为作者(带有到原始来源的链接)。我忘了保护链接
编辑:您还应该查看此页面@Codex. 在那里,您可以看到触发顺序的顺序
应该给您一个开始:/root/index.php > wp-blog-header.php > wp-load.php > wp-config.php > wp-settings.php > \\wp-includes\\load.php > \\wp-includes\\default-constants.php > ...
最好是从某处获取一些调试类,只需检查includes本地。