From 294a164b15f22c8c379c2250b52a148f060a3547 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Wed, 13 Jan 2016 03:13:25 +0000 Subject: [PATCH] Ignore hierarchy in pagination calculation when comment threading is disabled. In order to calculate comment pagination when newest comments are displayed first, `comments_template()` must perform a separate query to determine the total number of paginating comments available on a post. See [34729], #8071, pagination calculation - can be defined as a top-level comment, or a comment with `parent=0`. However, when comment threading is disabled, yet comments exist in the database that have parents, all comments - even those with a parent - are "paginating". (This typically happens when comments threading was once enabled, but has since been turned off.) As such, the total-paginating- comments query should only be limited to top-level comments when 'thread_comments' is disabled. Props jmdodd. Fixes #35419. Built from https://develop.svn.wordpress.org/trunk@36275 git-svn-id: http://core.svn.wordpress.org/trunk@36242 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 5 ++++- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 523422e7df..0bee2474e0 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -1323,10 +1323,13 @@ function comments_template( $file = '/comments.php', $separate_comments = false 'count' => true, 'orderby' => false, 'post_id' => $post->ID, - 'parent' => 0, 'status' => 'approve', ); + if ( $comment_args['hierarchical'] ) { + $top_level_args['parent'] = 0; + } + if ( isset( $comment_args['include_unapproved'] ) ) { $top_level_args['include_unapproved'] = $comment_args['include_unapproved']; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 75571a78cc..71b7650c2a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36274'; +$wp_version = '4.5-alpha-36275'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.