Skip to content

Commit cc613bb

Browse files
committed
Expand the comment.
1 parent 2becd37 commit cc613bb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/wp-includes/general-template.php

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

4667-
// Modify base and format default values if rewrite rules do not include a trailing slash.
4667+
/*
4668+
* Modify defaults for sites without trailing slashed permalinks.
4669+
*
4670+
* Ensures sites not using trailing slashes get links in the form
4671+
* `/page/2` rather than `/page/2/`. On these sites, linking to the
4672+
* URL with a trailing slash will results in a 301 redirect from the
4673+
* incorrect URL to the correctly formattted one. This presents an
4674+
* unnecessary performance hit.
4675+
*/
46684676
if ( $wp_rewrite->using_permalinks() && ! $wp_rewrite->use_trailing_slashes ) {
46694677
$pagenum_link = str_replace( '/%_%', '%_%', $pagenum_link );
46704678
$format = '/' . ltrim( $format, '/' );

0 commit comments

Comments
 (0)