mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 15:16:29 +01:00
Handle page= and feed= query strings in redirect_guess_404_permalink(). fixes #20387
git-svn-id: http://svn.automattic.com/wordpress/trunk@20398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5ccce3d681
commit
170ce91194
@ -101,7 +101,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
|||||||
|
|
||||||
if ( ! $redirect_url ) {
|
if ( ! $redirect_url ) {
|
||||||
if ( $redirect_url = redirect_guess_404_permalink( $requested_url ) ) {
|
if ( $redirect_url = redirect_guess_404_permalink( $requested_url ) ) {
|
||||||
$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
|
$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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,6 +489,11 @@ function redirect_guess_404_permalink( $current_url = '' ) {
|
|||||||
$post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE $where AND post_status = 'publish'");
|
$post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE $where AND post_status = 'publish'");
|
||||||
if ( ! $post_id )
|
if ( ! $post_id )
|
||||||
return false;
|
return false;
|
||||||
|
if ( get_query_var( 'feed' ) )
|
||||||
|
return get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) );
|
||||||
|
elseif ( get_query_var( 'page' ) )
|
||||||
|
return trailingslashit( get_permalink( $post_id ) ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' );
|
||||||
|
else
|
||||||
return get_permalink( $post_id );
|
return get_permalink( $post_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user