Make WordPress Core

Changeset 20396


Ignore:
Timestamp:
04/07/2012 05:02:45 AM (13 years ago)
Author:
markjaquith
Message:

Fix a bunch of individual post comments feeds canonical redirects. Fixes three unit tests. fixes #20384

File:
1 edited

Legend:

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

    r20395 r20396  
    6666    if ( !isset($redirect['query']) )
    6767        $redirect['query'] = '';
     68
     69    if ( is_feed() && ( $id = get_query_var( 'p' ) ) ) {
     70        if ( $redirect_url = get_post_comments_feed_link( $id, get_query_var( 'feed' ) ) ) {
     71            $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed'), $redirect_url );
     72            $redirect['path'] = parse_url( $redirect_url, PHP_URL_PATH );
     73        }
     74    }
    6875
    6976    if ( is_singular() && 1 > $wp_query->post_count && ($id = get_query_var('p')) ) {
     
    220227            if ( is_feed() && in_array( get_query_var('feed'), $wp_rewrite->feeds ) ) {
    221228                $addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : '';
    222                 if ( get_query_var( 'withcomments' ) )
     229                if ( !is_singular() && get_query_var( 'withcomments' ) )
    223230                    $addl_path .= 'comments/';
    224231                if ( ( 'rss' == get_default_feed() && 'feed' == get_query_var('feed') ) || 'rss' == get_query_var('feed') )
Note: See TracChangeset for help on using the changeset viewer.