Make WordPress Core


Ignore:
Timestamp:
06/05/2014 02:09:12 AM (11 years ago)
Author:
SergeyBiryukov
Message:

Avoid an empty href attribute in paginate_links(). Add unit tests.

props obenland, Nessworthy.
fixes #24606.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r28669 r28671  
    24772477    $page_links = array();
    24782478    $dots = false;
     2479    $base = str_replace( '%_%', $args['format'], $args['base'] );
    24792480
    24802481    if ( $args['prev_next'] && $current && 1 < $current ) :
    2481         $link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] );
    2482         $link = str_replace( '%#%', $current - 1, $link );
     2482        $link = str_replace( '%#%', $current - 1, $base );
    24832483        if ( $add_args )
    24842484            $link = add_query_arg( $add_args, $link );
     
    25002500        else :
    25012501            if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
    2502                 $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
    2503                 $link = str_replace( '%#%', $n, $link );
     2502                $link = str_replace( '%#%', $n, $base );
    25042503                if ( $add_args )
    25052504                    $link = add_query_arg( $add_args, $link );
     
    25162515    endfor;
    25172516    if ( $args['prev_next'] && $current && ( $current < $total || -1 == $total ) ) :
    2518         $link = str_replace( '%_%', $args['format'], $args['base'] );
    2519         $link = str_replace( '%#%', $current + 1, $link );
     2517        $link = str_replace( '%#%', $current + 1, $base );
    25202518        if ( $add_args )
    25212519            $link = add_query_arg( $add_args, $link );
Note: See TracChangeset for help on using the changeset viewer.