WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#34057 closed defect (bug) (fixed)

`get_page_of_comment()` not limiting query to proper post

Reported by: boonebgorges Owned by:
Milestone: 4.4 Priority: high
Severity: normal Version:
Component: Comments Keywords:
Focuses: Cc:

Description

[34535] changed get_page_of_comment() so that it uses WP_Comment_Query, but it was done incorrectly. The 'post_ID' parameter of WP_Comment_Query does nothing; it should be 'post_id' instead. (That's a separate mess that ought to be cleaned up at some point.)

Aside from creating incorrect comment pages, this bug is also exhausting resources on blogs with many comments.

Change History (6)

#1 @boonebgorges
5 years ago

In 34660:

Use correct 'page_id' parameter in get_page_of_comment().

See #34057.

#2 @boonebgorges
5 years ago

In 34661:

In get_page_of_comment(), use a true COUNT query.

This improves memory usage by not compiling a list of comment IDs.

See #34057.

#3 @boonebgorges
5 years ago

#34050 was marked as a duplicate.

#4 @boonebgorges
5 years ago

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

This ought to be fixed.

#5 follow-up: @knutsp
5 years ago

@boonebgorges:
Why have comment-page-1/ in almost every comment permalink? This part used not to be present unless comment page > 1. See https://make.wordpress.org/core/comments/feed/

I this has not the same cause as what is fixed here, I can open a new ticket.

#6 in reply to: ↑ 5 @boonebgorges
5 years ago

Replying to knutsp:

@boonebgorges:
Why have comment-page-1/ in almost every comment permalink? This part used not to be present unless comment page > 1. See https://make.wordpress.org/core/comments/feed/

I this has not the same cause as what is fixed here, I can open a new ticket.

It's not really the same issue, but it's a legitimate one, and more closely related to #8071. Please open a separate ticket.

Note: See TracTickets for help on using tickets.