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()時,上述函數不會被調用。
我該如何使刪除功能的行動工作?