mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Properly redirect custom post type URLs in redirect_canonical(). fixes #13561
git-svn-id: http://svn.automattic.com/wordpress/trunk@14954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3dae667671
commit
7baab2607d
@ -75,7 +75,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
|
||||
$id = $vars->post_parent;
|
||||
|
||||
if ( $redirect_url = get_permalink($id) )
|
||||
$redirect['query'] = remove_query_arg(array('p', 'page_id', 'attachment_id'), $redirect['query']);
|
||||
$redirect['query'] = remove_query_arg(array('p', 'page_id', 'attachment_id', 'post_type'), $redirect['query']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
|
||||
$post_type_obj = get_post_type_object($redirect_post->post_type);
|
||||
if ( $post_type_obj->public ) {
|
||||
$redirect_url = get_permalink($redirect_post);
|
||||
$redirect['query'] = remove_query_arg(array('p', 'page_id', 'attachment_id'), $redirect['query']);
|
||||
$redirect['query'] = remove_query_arg(array('p', 'page_id', 'attachment_id', 'post_type'), $redirect['query']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
|
||||
$redirect['query'] = remove_query_arg('attachment_id', $redirect['query']);
|
||||
} elseif ( is_single() && !empty($_GET['p']) && ! $redirect_url ) {
|
||||
if ( $redirect_url = get_permalink(get_query_var('p')) )
|
||||
$redirect['query'] = remove_query_arg('p', $redirect['query']);
|
||||
$redirect['query'] = remove_query_arg(array('p', 'post_type'), $redirect['query']);
|
||||
if ( get_query_var( 'page' ) ) {
|
||||
$redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' );
|
||||
$redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
|
||||
|
Loading…
Reference in New Issue
Block a user