Make WordPress Core

Opened 8 years ago

Last modified 5 years ago

#35432 new enhancement

`wp_list_comments()` should perform a more modest fallback comment query

Reported by: boonebgorges's profile boonebgorges Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Comments Keywords: needs-patch
Focuses: performance Cc:

Description

Previously: #35175, #35356, #8071.

In 4.4, comments_template() was updated so that it no longer queries for every single comment belonging to a post; instead, it only fetches the comments appropriate for the current comment-page. See #8071. This change introduced a bug in wp_list_comments(): since all of the post's comments were no longer available in $wp_query->comments, it was no longer possible to pass custom (read: differing from $wp_query) pagination params to wp_list_comments() and get the proper comments back. We addressed this problem in 4.4.1 by adding a clause to wp_list_comments() that falls back on the old behavior - querying for all of the post's comments - if non-default pagination params are provided. See #35175 [36157].

This fallback solution is obviously not ideal. Querying for all of a post's comments is what #8071 was supposed to fix. wp_list_comments(), like comments_template(), should be able to perform a fallback query that fetches only the required comments.

The necessary logic already exists in comments_template(), so this may be a relatively simple matter of porting the functionality over, or abstracting it for use in both functions.

cc @smerriman

Change History (0)

Note: See TracTickets for help on using tickets.