[wp-trac] [WordPress Trac] #27571: WP_Comment_Query::query() querying for too much data

WordPress Trac noreply at wordpress.org
Sat Sep 26 13:25:03 UTC 2015


#27571: WP_Comment_Query::query() querying for too much data
--------------------------+---------------------------
 Reporter:  mkilian       |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  4.4
Component:  Comments      |     Version:  3.8.1
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+---------------------------
Changes (by boonebgorges):

 * status:  reopened => assigned


Comment:

 [34583] is also going to cause problems for people who are actually using
 this data inside of a comment loop. Referencing `$comment->post_title` etc
 for all 50 comments on a page is going to result in 50 database queries
 when no persistent cache is in use. At the very least, we should provide a
 flag that lets people decide that they want post data loaded.

 Also, I think the fallback logic is too liberal here - `$comment->foo`
 shouldn't force the post to be loaded. We should have a whitelist of post
 properties, and lazy load only when those are requested.

 I'll look at it if you don't get a chance before I do.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27571#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list