From d74ab4b6df79fa93687a1fcf133fdeb17a97c1db Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 31 Oct 2015 20:53:41 +0000 Subject: [PATCH] Canonical: when `/%post_id%/` is the permalink structure, don't redirect IDs that match Auto Drafts. Props SergeyBiryukov. Fixes #29431. git-svn-id: https://develop.svn.wordpress.org/trunk@35480 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/canonical.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php index c7f7e11555..84b90e279e 100644 --- a/src/wp-includes/canonical.php +++ b/src/wp-includes/canonical.php @@ -117,7 +117,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { $id = max( get_query_var('p'), get_query_var('page_id'), get_query_var('attachment_id') ); if ( $id && $redirect_post = get_post($id) ) { $post_type_obj = get_post_type_object($redirect_post->post_type); - if ( $post_type_obj->public ) { + if ( $post_type_obj->public && 'auto-draft' != $redirect_post->post_status ) { $redirect_url = get_permalink($redirect_post); $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); }