WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/23/2008 06:55:22 PM (13 years ago)
Author:
ryan
Message:

pretty permalinks for comment paging. Props Viper007Bind. fixes #7942

File:
1 edited

Legend:

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

    r9214 r9300  
    124124
    125125    // paging and feeds
    126         if ( get_query_var('paged') || is_feed() ) {
     126        if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) {
    127127            if ( !$redirect_url )
    128128                $redirect_url = $requested_url;
    129129            $paged_redirect = @parse_url($redirect_url);
    130             while ( preg_match( '#page/[0-9]+?(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/feed(/[a-z0-9-]*?(/+)?)?$#', $paged_redirect['path'] ) ) {
     130            while ( preg_match( '#page/[0-9]+?(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/feed(/[a-z0-9-]*?(/+)?)?$#', $paged_redirect['path'] ) || preg_match( '#comment-page-[0-9]+/?$#', $paged_redirect['path'] ) ) {
    131131                // Strip off paging and feed
    132132                $paged_redirect['path'] = preg_replace('#/page/[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing paging
    133133                $paged_redirect['path'] = preg_replace('#/feed(/[a-z0-9-]*?(/+)?)?$#', '/', $paged_redirect['path']); // strip off any existing feed
     134                $paged_redirect['path'] = preg_replace('#comment-page-[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing comment paging
    134135            }
    135136
     
    149150                $paged_redirect['path'] = user_trailingslashit( trailingslashit( $paged_redirect['path'] ) . 'feed/' . ( ( 'rss2' ==  get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' );
    150151            }
     152            if ( get_query_var('cpage') > 1 ) {
     153                $paged_redirect['path'] = user_trailingslashit( trailingslashit( $paged_redirect['path'] ) . 'comment-page-' . get_query_var('cpage'), 'commentpaged' );
     154            }
    151155            $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path'];
    152156            $redirect['path'] = $paged_redirect['path'];
    153157            $redirect['query'] = remove_query_arg( 'paged', $redirect['query'] );
    154             $redirect['query'] = remove_query_arg(  'feed', $redirect['query'] );
     158            $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
     159            $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
    155160        }
    156161    }
Note: See TracChangeset for help on using the changeset viewer.