Redirect alternate is_single() URLs (like multiple category-based urls) to the canonical URL. fixes #6627

git-svn-id: http://svn.automattic.com/wordpress/trunk@9193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2008-10-15 22:00:12 +00:00
parent 75bd6b32a8
commit 77da070d7a
1 changed files with 2 additions and 0 deletions

View File

@ -80,6 +80,8 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
if ( is_single() && isset($_GET['p']) && ! $redirect_url ) { if ( is_single() && isset($_GET['p']) && ! $redirect_url ) {
if ( $redirect_url = get_permalink(get_query_var('p')) ) if ( $redirect_url = get_permalink(get_query_var('p')) )
$redirect['query'] = remove_query_arg('p', $redirect['query']); $redirect['query'] = remove_query_arg('p', $redirect['query']);
} elseif ( is_single() && ! $redirect_url ) {
$redirect_url = get_permalink( url_to_postid( $requested_url ) );
} elseif ( is_page() && isset($_GET['page_id']) && ! $redirect_url ) { } elseif ( is_page() && isset($_GET['page_id']) && ! $redirect_url ) {
if ( $redirect_url = get_permalink(get_query_var('page_id')) ) if ( $redirect_url = get_permalink(get_query_var('page_id')) )
$redirect['query'] = remove_query_arg('page_id', $redirect['query']); $redirect['query'] = remove_query_arg('page_id', $redirect['query']);