Make WordPress Core

Opened 6 years ago

Last modified 6 weeks ago

#51492 new defect (bug)

Wrong order of comments when using numbered pagination

Reported by: askel45 Owned by:
Priority: normal Milestone: Awaiting Review
Component: Comments Version: 5.5.1
Severity: normal Keywords: close
Cc: Focuses:

Description

Using paginate_comments_links() to show numbered pagination in comments instead of 'older comments' or 'newer comments' causes a problem. When comments are broken into pages, with the last page and newer comments shown by default, the numbered pagination shows the current page as the last in the pagination. For example, if there are 60 comments broken down to 20 comments per page, the initial post-loading shows page 3 as the current page (instead of page 1) and a person has to navigate backwards to read other comments (page 2 then page 1).

Change History (2)

#1 @SergeyBiryukov
6 years ago

  • Summary Worng order of comments when using numbered pagination → Wrong order of comments when using numbered pagination

#2 @huzaifaalmesbah
6 weeks ago

  • Keywords close added; dev-feedback 2nd-opinion needs-testing removed

I investigated and tested this ticket on WordPress Trunk (7.2-alpha-63166-src) to evaluate the behavior of paginate_comments_links().

Observations

In Settings → Discussion, under the "Comment Pagination" section:

  • Break comments into pages: Checked
  • Comments page to display by default: last page (or first page)
  1. When Comments page to display by default is set to last page (default_comments_page = 'newest'):
    • WordPress intentionally serves the highest comment page (e.g. Page 3 of 3) on the single post URL so readers see the newest comments first.
    • Because Page 3 is what is currently rendered on screen, paginate_comments_links() correctly marks Page 3 as the active page:
      « Previous  1  2  [3]
      
  1. When Comments page to display by default is set to first page (default_comments_page = 'oldest'):
    • WordPress serves Page 1 on initial load.
    • paginate_comments_links() marks Page 1 as the active page:
      [1]  2  3  Next »
      

Conclusion & Recommendation

This behavior is working as designed according to the core Discussion settings under Comment Pagination. If a site owner wants pagination to start on Page 1 by default, selecting first page achieves this without requiring core code changes.

Since this ticket was opened against WordPress 5.5 and has seen no further reproduction issues over multiple major releases, I recommend closing this ticket as worksforme.

Removing needs-testing, dev-feedback, 2nd-opinion and adding the close keyword for maintainer review.

Note: See TracTickets for help on using tickets.