Make WordPress Core

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#29685 closed defect (bug) (invalid)

WP_Comments_List_Table total_comments count wrong when using meta_query

Reported by: ragulka Owned by:
Priority: normal Milestone:
Component: Comments Version: 3.9
Severity: normal Keywords:
Cc: Focuses: administration, performance

Description

When a meta_query is used to fetch comments in the WP_Comments_List_Table, the $total_comments will always return 1, and not the correct number of total comments found.

This is because the total count is queried using COUNT (*) and the WP_Comment_Query query method
​automatically adds GROUP BY {$wpdb->comments}.comment_ID to the query. This results in the query returning multiple rows, each with the count of 1.

Removing the GROUP BY clause seems to fix the problem, although I'm not sure if there can be any other adverse effects to this.

It seems that when querying the total count of posts on the edit-posts screen, SQL_CALC_FOUND_ROWS is used instead. I'm not sure if we want to use that approach or simply remove the GROUP BY clause. Or perhaps there is a third option?

Change History (3)

#1 @dd32
12 years ago

  • Summary WC_Comments_List_Table total_comments count wrong when using meta_query → WP_Comments_List_Table total_comments count wrong when using meta_query

#2 @tyxla
11 years ago

  • Resolution → invalid
  • Status new → closed

This has already been fixed in [30026], see #23369.

#3 @netweb
11 years ago

  • Milestone Awaiting Review
Note: See TracTickets for help on using tickets.