查看选项\'rewrite_rules\'
已重置–就是这样flush_rewrite_rules()
内部执行–钩住选项操作并记录发生的情况。
下面的小插件可以做到这一点。它将告诉您哪些代码刷新了重写规则,以及刷新前后规则的外观。如果没有冲水,只会说nothing logged
. :)
<?php
/* Plugin Name: Debug rewrite rule flushing */
add_action( \'plugins_loaded\', \'wpse_67368_debug_rewrite_flushes\' );
function wpse_67368_debug_rewrite_flushes()
{
static $log = array ();
if ( \'plugins_loaded\' === current_filter() )
{
$hooks = array (
\'added_option\',
\'updated_option\',
\'deleted_option\',
\'shutdown\'
);
foreach ( $hooks as $hook )
{
add_action( $hook, __FUNCTION__, 10, 3 );
}
return;
}
if ( \'shutdown\' === current_filter() )
{
empty ( $log ) and $log = \'nothing logged\';
printf( \'<pre>%s</pre>\', var_export( $log, TRUE ) );
return;
}
$args = func_get_args();
$option = array_shift( $args );
if ( \'rewrite_rules\' === $option )
{
$log[] = array (
\'filter\' => current_filter(),
\'option\' => $option,
\'args\' => $args,
\'backtrace\' => debug_backtrace()
);
}
}