Skip to content

Commit 9bea7c3

Browse files
committed
Expand the comment.
1 parent 2af697d commit 9bea7c3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/wp-includes/general-template.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4651,7 +4651,15 @@ function paginate_links( $args = '' ) {
46514651
$format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
46524652
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
46534653

4654-
// Modify base and format default values if rewrite rules do not include a trailing slash.
4654+
/*
4655+
* Modify defaults for sites without trailing slashed permalinks.
4656+
*
4657+
* Ensures sites not using trailing slashes get links in the form
4658+
* `/page/2` rather than `/page/2/`. On these sites, linking to the
4659+
* URL with a trailing slash will results in a 301 redirect from the
4660+
* incorrect URL to the correctly formattted one. This presents an
4661+
* unnecessary performance hit.
4662+
*/
46554663
if ( $wp_rewrite->using_permalinks() && ! $wp_rewrite->use_trailing_slashes ) {
46564664
$pagenum_link = str_replace( '/%_%', '%_%', $pagenum_link );
46574665
$format = '/' . ltrim( $format, '/' );

0 commit comments

Comments
 (0)