[wp-trac] [WordPress Trac] #8071: Refrain from querying all the comments on a post when paged

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 16 04:35:24 UTC 2012


#8071: Refrain from querying all the comments on a post when paged
-------------------------+-----------------------------
 Reporter:  markjaquith  |       Owner:
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  Future Release
Component:  Comments     |     Version:  2.7
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |
-------------------------+-----------------------------

Comment (by wonderboymusic):

 I just did this (get all comments for post but just id=>parent / cache it)
 for my implementation of threaded replies in bbPress - once you do that,
 Walker can figure out hierarchy, but you need to do a Walker before you
 query paged comments so you can do an IN query for the cpage instead of
 calling get_comment( ) for every item in the comment loop

 I'll attach code if what I did is portable

 Doing the walker for the page will also get you a proper pagination
 matrix, and allow you to display 1-{total number of comments} vs 1-{total
 number of top level comments per page}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/8071#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list