mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Canonical / Query: Restore the is_404()
check in wp_old_slug_redirect()
which was removed in [34659].
This reverts part of [34659] due to excessive canonical problems it's caused in 4.4.x. Fixes #35344, #21602 for the 4.4 branch. git-svn-id: https://develop.svn.wordpress.org/branches/4.4@36280 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c30a5275e8
commit
bbbf6eab8a
@ -4981,16 +4981,11 @@ class WP_Query {
|
||||
*
|
||||
* @global WP_Query $wp_query Global WP_Query instance.
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
|
||||
*/
|
||||
function wp_old_slug_redirect() {
|
||||
global $wp_query, $wp_rewrite;
|
||||
global $wp_query;
|
||||
|
||||
if ( get_queried_object() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( '' !== $wp_query->query_vars['name'] ) :
|
||||
if ( is_404() && '' !== $wp_query->query_vars['name'] ) :
|
||||
global $wpdb;
|
||||
|
||||
// Guess the current post_type based on the query vars.
|
||||
@ -5038,13 +5033,6 @@ function wp_old_slug_redirect() {
|
||||
$link = user_trailingslashit( trailingslashit( $link ) . 'page/' . $GLOBALS['wp_query']->query_vars['paged'] );
|
||||
} elseif( is_embed() ) {
|
||||
$link = user_trailingslashit( trailingslashit( $link ) . 'embed' );
|
||||
} elseif ( is_404() ) {
|
||||
// Add rewrite endpoints if necessary.
|
||||
foreach ( $wp_rewrite->endpoints as $endpoint ) {
|
||||
if ( $endpoint[2] && false !== get_query_var( $endpoint[2], false ) ) {
|
||||
$link = user_trailingslashit( trailingslashit( $link ) . $endpoint[1] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user