Don't do a canonical redirect from author=x to /author/foo/ if the user is not an author
git-svn-id: http://svn.automattic.com/wordpress/trunk@17991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
569c17df7f
commit
f166e119f3
|
@ -141,8 +141,10 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||||
$redirect['query'] = remove_query_arg('year', $redirect['query']);
|
$redirect['query'] = remove_query_arg('year', $redirect['query']);
|
||||||
} elseif ( is_author() && !empty($_GET['author']) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) {
|
} elseif ( is_author() && !empty($_GET['author']) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) {
|
||||||
$author = get_userdata(get_query_var('author'));
|
$author = get_userdata(get_query_var('author'));
|
||||||
if ( false !== $author && $redirect_url = get_author_posts_url($author->ID, $author->user_nicename) )
|
if ( ( false !== $author ) && $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = %d AND $wpdb->posts.post_status = 'publish' LIMIT 1", $author->ID ) ) ) {
|
||||||
$redirect['query'] = remove_query_arg('author', $redirect['query']);
|
if ( $redirect_url = get_author_posts_url($author->ID, $author->user_nicename) )
|
||||||
|
$redirect['query'] = remove_query_arg('author', $redirect['query']);
|
||||||
|
}
|
||||||
} elseif ( is_category() || is_tag() || is_tax() ) { // Terms (Tags/categories)
|
} elseif ( is_category() || is_tag() || is_tax() ) { // Terms (Tags/categories)
|
||||||
|
|
||||||
$term_count = 0;
|
$term_count = 0;
|
||||||
|
|
Loading…
Reference in New Issue