diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index e454ecebe0..9f3d9a97ee 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -2431,6 +2431,9 @@ function get_pagenum_link( $pagenum = 1, $escape = true ) { $qs_regex = '|\?.*?$|'; preg_match( $qs_regex, $request, $qs_match ); + $parts = array(); + $parts[] = untrailingslashit( get_bloginfo( 'url' ) ); + if ( ! empty( $qs_match[0] ) ) { $query_string = $qs_match[0]; $request = preg_replace( $qs_regex, '', $request ); @@ -2442,17 +2445,21 @@ function get_pagenum_link( $pagenum = 1, $escape = true ) { $request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request ); $request = ltrim( $request, '/' ); - $base = trailingslashit( get_bloginfo( 'url' ) ); - if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' !== $request ) ) { - $base .= $wp_rewrite->index . '/'; + $parts[] = $wp_rewrite->index; } + $parts[] = untrailingslashit( $request ); + if ( $pagenum > 1 ) { - $request = ( ( ! empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . '/' . $pagenum, 'paged' ); + $parts[] = $wp_rewrite->pagination_base; + $parts[] = $pagenum; } - $result = $base . $request . $query_string; + $result = user_trailingslashit( implode( '/', array_filter( $parts ) ), 'paged' ); + if ( ! empty( $query_string ) ) { + $result .= $query_string; + } } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index ab04a759b7..4471364753 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-beta4-56938'; +$wp_version = '6.4-beta4-56939'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.