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
This commit is contained in:
parent
bd7bf83886
commit
d74ab4b6df
|
@ -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 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue