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.

Fixes #35031 for trunk.


Built from https://develop.svn.wordpress.org/trunk@36128


git-svn-id: http://core.svn.wordpress.org/trunk@36094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2015-12-31 03:01:29 +00:00
parent d160543282
commit b23280fe49
2 changed files with 5 additions and 1 deletions

View File

@ -4956,6 +4956,10 @@ class WP_Query {
function wp_old_slug_redirect() {
global $wp_query, $wp_rewrite;
if ( get_queried_object() ) {
return;
}
if ( '' !== $wp_query->query_vars['name'] ) :
global $wpdb;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36127';
$wp_version = '4.5-alpha-36128';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.