diff --git a/wp-feed.php b/wp-feed.php index 4b662f8abd..8f7dfba258 100644 --- a/wp-feed.php +++ b/wp-feed.php @@ -1,6 +1,6 @@ post2cat WHERE post_id = $postid"; - $wpdb->query($sql); - - $sql = "DELETE FROM $wpdb->posts WHERE ID = $postid"; - - $wpdb->query($sql); - $result = $wpdb->rows_affected; + $result = $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid"); + + if (!$result) + return $result; + + $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid"); + + $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid"); + + $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid"); return $result; }