Make WordPress Core


Ignore:
Timestamp:
02/26/2014 06:11:36 PM (11 years ago)
Author:
markjaquith
Message:

Return 404 when querying author's posts who is not a member and has no posts on the site

fixes #20601. props yoavf, nacin, SergeyBiryukov, wonderboymusic, markjaquith.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp.php

    r26644 r27290  
    569569        if ( ! is_paged() ) {
    570570
     571            // Don't 404 for authors without posts as long as they matched an author on this site.
     572            $author = get_query_var( 'author' );
     573            if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) {
     574                status_header( 200 );
     575                return;
     576            }
     577
    571578            // Don't 404 for these queries if they matched an object.
    572             if ( ( is_tag() || is_category() || is_tax() || is_author() || is_post_type_archive() ) && $wp_query->get_queried_object() ) {
     579            if ( ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() ) {
    573580                status_header( 200 );
    574581                return;
Note: See TracChangeset for help on using the changeset viewer.