Make WordPress Core


Ignore:
Timestamp:
01/13/2016 03:12:34 AM (9 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r36272 r36275  
    13241324                'orderby' => false,
    13251325                'post_id' => $post->ID,
    1326                 'parent'  => 0,
    13271326                'status'  => 'approve',
    13281327            );
     1328
     1329            if ( $comment_args['hierarchical'] ) {
     1330                $top_level_args['parent'] = 0;
     1331            }
    13291332
    13301333            if ( isset( $comment_args['include_unapproved'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.