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

WordPress Trac noreply at wordpress.org
Wed Jun 4 10:31:44 UTC 2025


#51662: 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         |  Resolution:
 Keywords:  has-patch      |     Focuses:
---------------------------+------------------------------

Comment (by djovanov):

 Fixed with this function php code :

 {{{
 add_filter( 'paginate_links', function( $link ) {
     // Supprime uniquement le slash final (pas ceux à l'intérieur)
     return preg_replace( '#(?<!:)/$#', '', $link );
 });
 }}}

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


More information about the wp-trac mailing list