[wp-trac] [WordPress Trac] #61393: Trailing Slash Issue in Category Pagination URLs with the_posts_pagination()

WordPress Trac noreply at wordpress.org
Thu Jun 6 19:37:32 UTC 2024


#61393: Trailing Slash Issue in Category Pagination URLs with
the_posts_pagination()
---------------------------+-----------------------------------------
 Reporter:  hmbashar       |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Permalinks     |    Version:
 Severity:  normal         |   Keywords:  needs-patch has-screenshots
  Focuses:  accessibility  |
---------------------------+-----------------------------------------
 Hello,

 I've checked a few themes that use the `the_posts_pagination()` function
 for pagination, and I think this function has a small issue. Although it’s
 not a major problem, it should still be addressed. If I remove the
 extra/trailing slash (/) at the end of the URL from the permalink
 structure (like `/%%postname%%` instead of `/%%postname%%/`), it works
 perfectly for all category pages except the first page.

 For example, if I have a category slug "uncategorized", the pagination for
 this category archive page works as follows:
 - https://wpdevelop.test/category/uncategorized/page/2
 - https://wpdevelop.test/category/uncategorized/page/3
 - https://wpdevelop.test/category/uncategorized/page/4

 However, if I hover over any other number in the pagination, it shows
 without the trailing slash (/). Check this screenshot:
 https://prnt.sc/GICqVaCdAD8e. But if I hover over page number 1, it shows
 with a trailing slash, like this:
 https://wpdevelop.test/category/uncategorized/. Check this screenshot:
 https://prnt.sc/n-eNn-P_Zr5x. After clicking on page number 1, it
 redirects to the URL without the slash:
 https://wpdevelop.test/category/uncategorized.

 So, I think if it redirects to remove the slash, the URL should also
 remove the slash when hovering over page number 1.

 == I've checked several themes with this behavior:

 - Twenty Fifteen Version: 3.7
 - Twenty Fourteen Version: 3.9
 - Twenty Nineteen Version: 2.8
 - Twenty Seventeen Version: 3.6
 - Twenty Sixteen Version: 3.2
 - Twenty Twenty Version: 2.6
 - Twenty Twenty-One Version: 2.2
 - Twenty Twenty-Two Version: 1.7
 - Astra Version: 4.7.0

 === How to Check the Issue:

 1. Activate any of the themes mentioned above.
 2. Add categories.
 3. Add a few posts with those categories to enable pagination.
 4. Set permalinks with a custom structure (`/%%postname%%`), ensuring you
 don’t include a slash at the end.
 5. Visit your category archive, e.g.,
 https://wpdevelop.test/category/uncategorized.
 6. Click pagination numbers and check the URLs.

 Check the screenshots for reference:
 - [https://prnt.sc/_pl4KbcyTwEX First screenshot]
 - [https://prnt.sc/GICqVaCdAD8e Hover screenshot]
 - [https://prnt.sc/n-eNn-P_Zr5x Page 1 hover screenshot]

 Thank you!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61393>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list