Make WordPress Core

Changeset 18015


Ignore:
Timestamp:
05/24/2011 03:49:02 PM (13 years ago)
Author:
ryan
Message:

Don't do a canonical redirect from author=x to /author/foo/ if the user is not an author

Location:
branches/3.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1

  • branches/3.1/wp-includes/canonical.php

    r17549 r18015  
    142142        } elseif ( is_author() && !empty($_GET['author']) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) {
    143143            $author = get_userdata(get_query_var('author'));
    144             if ( false !== $author && $redirect_url = get_author_posts_url($author->ID, $author->user_nicename) )
    145                 $redirect['query'] = remove_query_arg('author', $redirect['query']);
     144            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 ) ) ) {
     145                if ( $redirect_url = get_author_posts_url($author->ID, $author->user_nicename) )
     146                    $redirect['query'] = remove_query_arg('author', $redirect['query']);
     147            }
    146148        } elseif ( is_category() || is_tag() || is_tax() ) { // Terms (Tags/categories)
    147149
Note: See TracChangeset for help on using the changeset viewer.