WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#35378 closed defect (bug) (fixed)

Incorrect comment ordering when comment threading is turned off

Reported by: jmdodd Owned by: boonebgorges
Milestone: 4.4.2 Priority: normal
Severity: normal Version: 4.4
Component: Comments Keywords: fixed-major
Focuses: template Cc:

Description

comments_template() performs all comment queries with $comment_args['hierarchical'] = 'threaded' rather than checking the site option for thread_comments. When comment display is no longer threaded, the comments appear in flattened hierarchical order rather than chronologically. This is a regression from 4.3.2, where turning off threading resulted in comments ordered chronologically.

A conditional check also needs to be added prior to getting each comment's children. This operation is only needed when the array of $_comments contains only top-level comments.

Attachments (1)

35378.diff (1.7 KB) - added by jmdodd 2 years ago.

Download all attachments as: .zip

Change History (6)

@jmdodd
2 years ago

#1 @jmdodd
2 years ago

  • Keywords has-patch added

#2 @boonebgorges
2 years ago

  • Milestone changed from Awaiting Review to 4.4.2
  • Owner set to boonebgorges
  • Status changed from new to assigned

@jmdodd Thanks for the ticket and the patch!

#3 @boonebgorges
2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 36226:

In comments_template(), don't run hierarchical queries if comment threading is disabled.

When hierarchical=true, WP_Comment_Query will always fetch comments according
to the comment hierarchy, even if 'thread_comments' is disabled for the site.
This can cause problems when comment threading is disabled after threaded
comments have been recorded on the site; comments will no longer be returned in
a strictly chronological order.

We address the issue by refraining from querying hierarchically when comment
threading is disabled.

Props jmdodd.
Fixes #35378.

#4 @boonebgorges
2 years ago

  • Keywords fixed-major added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 4.4.2 consideration.

#5 @dd32
2 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 36353:

Comments: In comments_template(), don't run hierarchical queries if comment threading is disabled.

When hierarchical=true, WP_Comment_Query will always fetch comments according to the comment hierarchy, even if 'thread_comments' is disabled for the site.
This can cause problems when comment threading is disabled after threaded comments have been recorded on the site; comments will no longer be returned in a strictly chronological order.
We address the issue by refraining from querying hierarchically when comment threading is disabled.

Merges [36226] to the 4.4 branch.
Props jmdodd.
Fixes #35378.

Note: See TracTickets for help on using tickets.