Redirects: Prevent redirects if a queried object exists.
After [34659], it became possible to cause an incorrect redirect, by changing the slug of a post, then creating a new post with the old slug. The correct behaviour is to prevent redirecting to the old post. Props dd32, pento. Merge of [36128] to the 4.4 branch. Fixes #35031. Built from https://develop.svn.wordpress.org/branches/4.4@36129 git-svn-id: http://core.svn.wordpress.org/branches/4.4@36095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
63125cd75c
commit
715dba65bc
|
@ -4986,6 +4986,10 @@ class WP_Query {
|
||||||
function wp_old_slug_redirect() {
|
function wp_old_slug_redirect() {
|
||||||
global $wp_query, $wp_rewrite;
|
global $wp_query, $wp_rewrite;
|
||||||
|
|
||||||
|
if ( get_queried_object() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( '' !== $wp_query->query_vars['name'] ) :
|
if ( '' !== $wp_query->query_vars['name'] ) :
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4.1-alpha-36118';
|
$wp_version = '4.4.1-alpha-36129';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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