1
我有这样的动作/钩:在wordpress中删除钩子不兼容与删除功能?
add_action('before_delete_post', 'my_delete_function');
function my_delete_function($post_id) {
global $wpdb;
$achievement = get_the_category($post_id);
$h = $achievement[0]->cat_ID;
$s = ''.str_replace('"', '', $h);
if ($s == 6 || $s == 5){
$wpdb->query("DELETE FROM wp_votes WHERE post = ".$post_id) or die(mysql_error());
}
}
当我删除从管理职位以上的伟大工程。但是,当调用wp_delete_post()时,上述函数不会被调用。
我该如何使删除功能的行动工作?