Canonical: Only redirect non-existing page requests to the post permalink if the post is found.
Follow-up to [47760]. See #45337, #40773, #28081, #11694. Built from https://develop.svn.wordpress.org/trunk@47761 git-svn-id: http://core.svn.wordpress.org/trunk@47537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5b046976cc
commit
b1a275684a
|
@ -196,11 +196,13 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||||
$post_id = $wp_query->post->ID;
|
$post_id = $wp_query->post->ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $post_id ) {
|
||||||
$redirect_url = get_permalink( $post_id );
|
$redirect_url = get_permalink( $post_id );
|
||||||
|
|
||||||
$redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' );
|
$redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' );
|
||||||
$redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
|
$redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! $redirect_url ) {
|
if ( ! $redirect_url ) {
|
||||||
$redirect_url = redirect_guess_404_permalink();
|
$redirect_url = redirect_guess_404_permalink();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-47760';
|
$wp_version = '5.5-alpha-47761';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue