2
我正在爲WordPress構建手機插件,我想增加停用非移動兼容插件的可能性。Wordpress在手機上取消激活插件
我發現了一些有幫助的代碼,但不是我所需要的。
debug_filter("/^woocommerce/i");
function debug_filter($regex_filter_action_to_match = "//"){
global $wp_filter;
$hook=$wp_filter;
ksort($hook);
echo "<pre style='background-color:white;'>";
foreach($hook as $tag => $priority){
//check for a regex match of hook name
if (!preg_match($regex_filter_action_to_match, $tag)) continue;
echo "<br /><strong>$tag</strong><br />";
ksort($priority);
foreach($priority as $priority => $function){
echo " $priority \n";
foreach($function as $name => $properties) {
echo "\t$name ";
if (function_exists($name)){
$func = new ReflectionFunction($name);
$filename = $func->getFileName();
$start_line = $func->getStartLine() - 1; // it's actually - 1, otherwise you wont get the function() block
$path_info = pathinfo($filename);
print_r($func);
echo "<em style='font-size:90%;opacity:0.5;' title='{$filename}'> {$path_info[filename]}.{$path_info[extension]}: line {$start_line}</em>";
}
echo "<br />";
remove_filter($tag, $name, $priority);
//remove_action('init', array('Jetpack_Likes', 'action_init') );
}
}
}
echo '</pre>';
return;
}
有沒有人設法建立或知道一個類,將使用remove_filter & remove_action禁用插件。
感謝您的幫助。
- 戴夫
我想我已經找到了答案,謝謝你。測試完成後我會將其發佈在下面。 –