Canonical: when `/%post_id%/` is the permalink structure, don't redirect IDs that match Auto Drafts.

Props SergeyBiryukov.
Fixes #29431.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-10-31 20:54:25 +00:00
parent d8eacd51d8
commit 60eaf79b67
2 changed files with 2 additions and 2 deletions

View File

@ -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 );
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-beta2-35479';
$wp_version = '4.4-beta2-35480';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.