[wp-trac] [WordPress Trac] #50233: Limit pagination for comments

WordPress Trac noreply at wordpress.org
Mon Feb 2 07:35:10 UTC 2026


#50233: Limit pagination for comments
-------------------------------------------------+-------------------------
 Reporter:  devrekli                             |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Permalinks                           |     Version:  5.4.1
 Severity:  minor                                |  Resolution:
 Keywords:  has-patch has-unit-tests dev-        |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------
Changes (by huzaifaalmesbah):

 * keywords:  has-patch has-unit-tests needs-testing dev-feedback => has-
     patch has-unit-tests dev-feedback


Comment:

 == Patch Testing Report


 Patch Tested: [attachment:"50233.4.diff"]

 === Environment
 - WordPress: 7.0-alpha-61215-src
 - PHP: 8.2.30
 - Server: nginx/1.29.4
 - Database: mysqli (Server: 9.5.0 / Client: mysqlnd 8.2.30)
 - Browser: Chrome 144.0.0.0
 - OS: macOS
 - Theme: Twenty Twenty-Five 1.4
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.1

 === Steps taken
 1. Go to WP Dashbaord.
 2. Enabled Settings → Discussion → "Break comments into pages".
 3. Set "Top level comments per page" = 2.
 4. Created one post.
 5. Added some comment.
 6. Applied 50233.4.diff
 7. Visited invalid pagination URLs manually:
    - /hello-world/comment-page-2/
    - /hello-world/comment-page-5/
    - /hello-world/comment-page-9999/

 8. ✅ Patch is solving the problem


 === Expected result
 - Comment pages should only exist if comments fill that page.
 - Non-existent comment pages should not return 200.
 - Should redirect to the canonical post URL (or otherwise prevent
 duplicate content).


 === Additional Notes
 Before patch:
 - /comment-page-9999/ returned 200 and displayed the post.

 After patch:
 - /comment-page-9999/ redirects to /hello-world/
 - Tested multiple page numbers (2, 5, 9999) — all correctly redirected.
 - No regressions observed with valid comment pages.


 === Screenshots/Screencast with results
 Screencast demonstrating behavior before and after applying the patch:
 https://files.catbox.moe/jklocr.mp4

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


More information about the wp-trac mailing list