From 14eae0a8a731d578a2fc345de8b15396ee7aff9b Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 3 Dec 2015 15:49:37 +0000 Subject: [PATCH] Ensure that order is specified when querying for comment descendants. Props tellyworth. Fixes #34838. git-svn-id: https://develop.svn.wordpress.org/trunk@35757 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-comment-query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php index 1a8bff8d6b..e30094ddfc 100644 --- a/src/wp-includes/class-wp-comment-query.php +++ b/src/wp-includes/class-wp-comment-query.php @@ -883,7 +883,7 @@ class WP_Comment_Query { } $where = 'WHERE ' . implode( ' AND ', $where_clauses ) . ' AND comment_parent IN (' . implode( ',', array_map( 'intval', $parent_ids ) ) . ')'; - $comment_ids = $wpdb->get_col( "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']}" ); + $comment_ids = $wpdb->get_col( "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} ORDER BY comment_date_gmt ASC, comment_ID ASC" ); $level++; $levels[ $level ] = $comment_ids;