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/branches/3.1@18015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ddb08ef64c
commit
aed9098381
|
@ -141,8 +141,10 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
|||
$redirect['query'] = remove_query_arg('year', $redirect['query']);
|
||||
} elseif ( is_author() && !empty($_GET['author']) && preg_match( '|^[0-9]+$|', $_GET['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 ) ) ) {
|
||||
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)
|
||||
|
||||
$term_count = 0;
|
||||
|
|
Loading…
Reference in New Issue