| 1 | Index: ../Sites/wordpress-trunk/wp-includes/post.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- ../Sites/wordpress-trunk/wp-includes/post.php (revision 13885) |
|---|
| 4 | +++ ../Sites/wordpress-trunk/wp-includes/post.php (working copy) |
|---|
| 5 | @@ -1650,11 +1650,13 @@ |
|---|
| 6 | // Point all attachments to this post up one level |
|---|
| 7 | $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) ); |
|---|
| 8 | |
|---|
| 9 | - $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid )); |
|---|
| 10 | + $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post->post_parent )); |
|---|
| 11 | if ( ! empty($comment_ids) ) { |
|---|
| 12 | do_action( 'delete_comment', $comment_ids ); |
|---|
| 13 | - $in_comment_ids = "'" . implode("', '", $comment_ids) . "'"; |
|---|
| 14 | - $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_ID IN($in_comment_ids)" ); |
|---|
| 15 | + foreach ( $comment_ids as $comment_id ) { |
|---|
| 16 | + $force_delete_comment = true; |
|---|
| 17 | + wp_delete_comment( $comment_id, $force_delete_comment ); |
|---|
| 18 | + } |
|---|
| 19 | do_action( 'deleted_comment', $comment_ids ); |
|---|
| 20 | } |
|---|
| 21 | |
|---|