Don't 404 for categories, tags, and authors that exist but have no posts. see #5324

git-svn-id: https://develop.svn.wordpress.org/trunk@8761 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-08-28 19:58:57 +00:00
parent 5e69c6919c
commit 6e53d55b55
1 changed files with 7 additions and 1 deletions

View File

@ -294,10 +294,16 @@ class WP {
// or if the request was a regular query string request rather than a
// permalink request.
if ( (0 == count($wp_query->posts)) && !is_404() && !is_search() && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
// Don't 404 for these queries if they matched an object.
if ( ( is_tag() || is_category() || is_author() ) && $wp_query->get_queried_object() ) {
if ( !is_404() )
status_header( 200 );
return;
}
$wp_query->set_404();
status_header( 404 );
nocache_headers();
} elseif( is_404() != true ) {
} elseif ( !is_404() ) {
status_header( 200 );
}
}