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

WordPress Trac noreply at wordpress.org
Wed Sep 30 03:27:12 UTC 2015


#8071: Refrain from querying all the comments on a post when paged
--------------------------------------+---------------------------
 Reporter:  markjaquith               |       Owner:  boonebgorges
     Type:  enhancement               |      Status:  closed
 Priority:  normal                    |   Milestone:  4.4
Component:  Comments                  |     Version:  2.7
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  dev-feedback needs-patch  |     Focuses:
--------------------------------------+---------------------------

Comment (by Viper007Bond):

 Replying to [comment:33 boonebgorges]:
 > The way that comment pagination works is complicated and not very
 intuitive. The 0th page of comments - what you see when reading a post
 with no 'cpage' query var - contains either the most recent or the oldest
 #per_page comments, depending on your 'default_comments_page' setting.
 However, the behavior of non-zero 'cpage' is *not* sensitive to
 'default_comments_page'; cpage=2 always contains more recent comments than
 cpage=3, etc. In other words, when 'default_comments_page=newest', the
 order of comment pages (if you have 4 pages total) is 0, 3, 2, 1, where if
 you show the oldest page first, the order is 0, 1, 2, 3. (The magic, such
 as it is, is in `Walker_Comment`.)
 >
 > I don't think this makes a lot of sense, but I also don't know what
 would break if we changed the behavior. It's very likely that someone out
 there is building custom pagination links, and is expecting the behavior
 described above.

 This was my doing when I helped write comment paging back in the day and
 it was done this way so that comment permalinks are actually permanent.

 > cpage=2 always contains more recent comments than cpage=3, etc

 That's backwards. Page 1 is always the oldest comments, page 2 are
 slightly newer comments, and so forth.

 It needs to be this way otherwise as new comments were added, older
 comments would be bumped off of one page number and onto the next,
 rendering permalinks useless. What page a comment is on shouldn't ever
 change regardless of new comments or what page is displayed by default.

 The only exception to this is if you change the number of comments per
 page. Only way to avoid that is to have true comment permalinks instead of
 just page numbers with anchor tags.

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


More information about the wp-trac mailing list