WordPress.org

Make WordPress Core

Changeset 20398


Ignore:
Timestamp:
04/07/2012 05:39:08 AM (9 years ago)
Author:
markjaquith
Message:

Handle page= and feed= query strings in redirect_guess_404_permalink(). fixes #20387

File:
1 edited

Legend:

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

    r20397 r20398  
    102102        if ( ! $redirect_url ) {
    103103            if ( $redirect_url = redirect_guess_404_permalink( $requested_url ) ) {
    104                 $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
     104                $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
    105105            }
    106106        }
     
    490490        if ( ! $post_id )
    491491            return false;
    492         return get_permalink( $post_id );
     492        if ( get_query_var( 'feed' ) )
     493            return get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) );
     494        elseif ( get_query_var( 'page' ) )
     495            return trailingslashit( get_permalink( $post_id ) ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' );
     496        else
     497            return get_permalink( $post_id );
    493498    }
    494499
Note: See TracChangeset for help on using the changeset viewer.