diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 4a3966824e..220c45b14b 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -918,6 +918,12 @@ function get_page_of_comment( $comment_ID, $args = array() ) { if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent ) return get_page_of_comment( $comment->comment_parent, $args ); + if ( 'desc' === get_option( 'comment_order' ) ) { + $compare = 'after'; + } else { + $compare = 'before'; + } + $comment_args = array( 'type' => $args['type'], 'post_id' => $comment->comment_post_ID, @@ -928,7 +934,7 @@ function get_page_of_comment( $comment_ID, $args = array() ) { 'date_query' => array( array( 'column' => "$wpdb->comments.comment_date_gmt", - 'before' => $comment->comment_date_gmt, + $compare => $comment->comment_date_gmt, ) ), ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 7b4d136008..8c7944b055 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38739'; +$wp_version = '4.7-alpha-38740'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.