diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 1b08219206..34f7be10eb 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -2476,10 +2476,10 @@ function paginate_links( $args = '' ) { $r = ''; $page_links = array(); $dots = false; + $base = str_replace( '%_%', $args['format'], $args['base'] ); if ( $args['prev_next'] && $current && 1 < $current ) : - $link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] ); - $link = str_replace( '%#%', $current - 1, $link ); + $link = str_replace( '%#%', $current - 1, $base ); if ( $add_args ) $link = add_query_arg( $add_args, $link ); $link .= $args['add_fragment']; @@ -2499,8 +2499,7 @@ function paginate_links( $args = '' ) { $dots = true; else : if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : - $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); - $link = str_replace( '%#%', $n, $link ); + $link = str_replace( '%#%', $n, $base ); if ( $add_args ) $link = add_query_arg( $add_args, $link ); $link .= $args['add_fragment']; @@ -2515,8 +2514,7 @@ function paginate_links( $args = '' ) { endif; endfor; if ( $args['prev_next'] && $current && ( $current < $total || -1 == $total ) ) : - $link = str_replace( '%_%', $args['format'], $args['base'] ); - $link = str_replace( '%#%', $current + 1, $link ); + $link = str_replace( '%#%', $current + 1, $base ); if ( $add_args ) $link = add_query_arg( $add_args, $link ); $link .= $args['add_fragment'];