Make WordPress Core


Ignore:
Timestamp:
11/25/2008 09:28:42 PM (16 years ago)
Author:
markjaquith
Message:

Handle front page comment feeds in Canonical. fixes #8320

File:
1 edited

Legend:

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

    r9831 r9883  
    134134                $redirect_url = $requested_url;
    135135            $paged_redirect = @parse_url($redirect_url);
    136             while ( preg_match( '#/page/[0-9]+?(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/(feed|rss|rdf|atom|rss2)(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $paged_redirect['path'] ) ) {
     136            while ( preg_match( '#/page/[0-9]+?(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $paged_redirect['path'] ) ) {
    137137                // Strip off paging and feed
    138138                $paged_redirect['path'] = preg_replace('#/page/[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing paging
    139                 $paged_redirect['path'] = preg_replace('#/(feed|rss2?|rdf|atom)(/+)?$#', '/', $paged_redirect['path']); // strip off feed endings
     139                $paged_redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+)?$#', '/', $paged_redirect['path']); // strip off feed endings
    140140                $paged_redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing comment paging
    141141            }
     
    143143            $addl_path = '';
    144144            if ( is_feed() ) {
    145                 $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit( 'feed/' . ( ( 'rss2' ==  get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' );
     145                $addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : '';
     146                if ( get_query_var( 'withcomments' ) )
     147                    $addl_path .= 'comments/';
     148                $addl_path .= user_trailingslashit( 'feed/' . ( ( 'rss2' ==  get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' );
    146149                $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
    147150            }
Note: See TracChangeset for help on using the changeset viewer.