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. Built from https://develop.svn.wordpress.org/trunk@27290 git-svn-id: http://core.svn.wordpress.org/trunk@27146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c4545fbbf4
commit
d30ab62e44
|
@ -568,8 +568,15 @@ class WP {
|
|||
// We will 404 for paged queries, as no posts were found.
|
||||
if ( ! is_paged() ) {
|
||||
|
||||
// Don't 404 for authors without posts as long as they matched an author on this site.
|
||||
$author = get_query_var( 'author' );
|
||||
if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) {
|
||||
status_header( 200 );
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't 404 for these queries if they matched an object.
|
||||
if ( ( is_tag() || is_category() || is_tax() || is_author() || is_post_type_archive() ) && $wp_query->get_queried_object() ) {
|
||||
if ( ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() ) {
|
||||
status_header( 200 );
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue