File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4643,7 +4643,15 @@ function paginate_links( $args = '' ) {
46434643 $ format = $ wp_rewrite ->using_index_permalinks () && ! strpos ( $ pagenum_link , 'index.php ' ) ? 'index.php/ ' : '' ;
46444644 $ format .= $ wp_rewrite ->using_permalinks () ? user_trailingslashit ( $ wp_rewrite ->pagination_base . '/%#% ' , 'paged ' ) : '?paged=%#% ' ;
46454645
4646- // Modify base and format default values if rewrite rules do not include a trailing slash.
4646+ /*
4647+ * Modify defaults for sites without trailing slashed permalinks.
4648+ *
4649+ * Ensures sites not using trailing slashes get links in the form
4650+ * `/page/2` rather than `/page/2/`. On these sites, linking to the
4651+ * URL with a trailing slash will results in a 301 redirect from the
4652+ * incorrect URL to the correctly formattted one. This presents an
4653+ * unnecessary performance hit.
4654+ */
46474655 if ( $ wp_rewrite ->using_permalinks () && ! $ wp_rewrite ->use_trailing_slashes ) {
46484656 $ pagenum_link = str_replace ( '/%_% ' , '%_% ' , $ pagenum_link );
46494657 $ format = '/ ' . ltrim ( $ format , '/ ' );
You can’t perform that action at this time.
0 commit comments