用于销毁包含该帖子注释的帖子的Sql命令:
$post_status = \'trash\';
$post_array = \'1, 2, 3\'; //post_ids comma separated
$wpdb->query($wpdb->prepare(
"UPDATE
`wp_posts`,
`wp_comments`
SET
wp_posts.post_status= %s,
wp_comments.comment_approved= %s
WHERE
wp_posts.ID = wp_comments.comment_post_ID AND
wp_posts.ID IN ( $post_array )",
$post_status,
$post_status
));