Make WordPress Core

Changeset 5974


Ignore:
Timestamp:
08/29/2007 06:10:11 PM (19 years ago)
Author:
markjaquith
Message:

Fix paging and preview links for canonical stuff. see #4773. fixes #4862

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/canonical.php

    r5921 r5974  
    6565                }
    6666
    67                 // paging
    68                 if ( is_paged() && strpos($redirect['query'], 'paged=') !== false ) {
    69                         if ( $paged = get_query_var('paged') ) {
    70                                 if ( $paged > 1 ) {
    71                                         if ( !$redirect_url )
    72                                                 $redirect_url = $requested_url;
    73                                         $paged_redirect = @parse_url($redirect_url);
    74                                         $paged_redirect['path'] = preg_replace('|/index.php/?$|', '/', $paged_redirect['path']);
    75                                         $paged_redirect['path'] = trailingslashit($paged_redirect['path']);
    76                                         if ( $wp_rewrite->using_index_permalinks() && strpos($paged_redirect['path'], '/index.php/') === false )
    77                                                 $paged_redirect['path'] .= 'index.php/';
    78                                         $paged_redirect['path'] .= user_trailingslashit("page/$paged");
    79                                         $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path'];
    80                                 }
    81                                 $redirect['query'] = remove_query_arg('paged', $redirect['query']);
     67        // paging
     68                if ( $paged = get_query_var('paged') ) {
     69                        if ( $paged > 1 ) {
     70                                if ( !$redirect_url )
     71                                        $redirect_url = $requested_url;
     72                                $paged_redirect = @parse_url($redirect_url);
     73                                $paged_redirect['path'] = preg_replace('|/index.php/?$|', '/', $paged_redirect['path']);
     74                                $paged_redirect['path'] = trailingslashit($paged_redirect['path']);
     75                                if ( $wp_rewrite->using_index_permalinks() && strpos($paged_redirect['path'], '/index.php/') === false )
     76                                        $paged_redirect['path'] .= 'index.php/';
     77                                $paged_redirect['path'] .= user_trailingslashit("page/$paged");
     78                                $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path'];
    8279                        }
     80                        $redirect['query'] = remove_query_arg('paged', $redirect['query']);
    8381                }
    8482        }
    8583
    8684        // tack on any additional query vars
    87         if ( $redirect_url && $redirect['query'] )
    88                 $redirect_url .= '?' . $redirect['query'];
     85        if ( $redirect_url && $redirect['query'] ) {
     86                if ( strpos($redirect_url, '?') !== false )
     87                        $redirect_url .= '&';
     88                else
     89                        $redirect_url .= '?';
     90                $redirect_url .= $redirect['query'];
     91        }
    8992
    9093        if ( !$redirect_url ) { // we're only going down this road if we don't have a WP-generated link from above
Note: See TracChangeset for help on using the changeset viewer.