WordPress.org

Make WordPress Core

Ticket #37703: 37703-delete-desc.diff

File 37703-delete-desc.diff, 1.2 KB (added by peterwilsoncc, 13 months ago)
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index e8e6732dc7..6f68462d0d 100644
    a b function wp_delete_post( $postid = 0, $force_delete = false ) { 
    30143014
    30153015        wp_defer_comment_counting( true );
    30163016
    3017         $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid ) );
     3017        $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d ORDER BY comment_ID DESC", $postid ) );
    30183018        foreach ( $comment_ids as $comment_id ) {
    30193019                wp_delete_comment( $comment_id, true );
    30203020        }
    function wp_delete_attachment( $post_id, $force_delete = false ) { 
    56625662
    56635663        wp_defer_comment_counting( true );
    56645664
    5665         $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ) );
     5665        $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d ORDER BY comment_ID DESC", $post_id ) );
    56665666        foreach ( $comment_ids as $comment_id ) {
    56675667                wp_delete_comment( $comment_id, true );
    56685668        }