[wp-trac] [WordPress Trac] #51662: WordPress 5.5.1 pagination adds extra trailing slash at the end of some URLs

WordPress Trac noreply at wordpress.org
Thu Oct 29 10:20:37 UTC 2020


#51662: WordPress 5.5.1 pagination adds extra trailing slash at the end of some
URLs
---------------------------+-----------------------------
 Reporter:  thornsteps     |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Rewrite Rules  |    Version:  5.5.1
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 WordPress 5.5.1 pagination adds extra trailing slash at the end of some
 URLs.

 Normally, our website's URLs don't have trailing slash at the end of the
 URL.

 We have found some bug on the_posts_pagination() function on WordPress
 5.5.1.

 [At page 2 of a category]https://stepstraining.co/strategy/page/2:
 **Previous link** = https://stepstraining.co/strategy/
 **Page 1 link** = https://stepstraining.co/strategy/

 [At page 3 or more than page 3 of a
 category]https://stepstraining.co/strategy/page/3:
 **Page 1 link** = https://stepstraining.co/strategy/

 All of the above URLs will 301 redirect to
 https://stepstraining.co/strategy --it should not have trailing slash at
 the end of the URL in the first place.



 [At page 2 of a tag]https://stepstraining.co/seo/page/2:
 **Previous link** = https://stepstraining.co/seo/
 **Page 1 link** = https://stepstraining.co/seo/

 [At page 3 or more than page 3 of a
 tag]https://stepstraining.co/seo/page/3:
 **Page 1 link** = https://stepstraining.co/seo/

 All of the above URLs will 301 redirect to https://stepstraining.co/seo
 --it should not have trailing slash at the end of the URL in the first
 place.


 The bug was gone when we tested adding **untrailingslashit()** to below
 code:
 **File** : /wp-includes/general-template.php
 esc_url( apply_filters( 'paginate_links', untrailingslashit($link) ) ),

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


More information about the wp-trac mailing list