WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/20/2010 09:10:20 PM (9 years ago)
Author:
ryan
Message:

If the queried term does not exist make sure no posts are returned in the query rather than falling through to querying all posts. Fixes 404s when querying cats that do not exist. see #12891

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r16506 r16511  
    19481948            $clauses = call_user_func_array( 'get_tax_sql', array( $this->tax_query, $wpdb->posts, 'ID', &$this) );
    19491949
    1950             $join .= $clauses['join'];
    1951             $where .= $clauses['where'];
     1950            if ( empty($clauses['join']) && empty($clauses['where']) ) {
     1951                $where .= ' AND 0 = 1';
     1952            } else {
     1953                $join .= $clauses['join'];
     1954                $where .= $clauses['where'];
     1955            }
    19521956
    19531957            if ( $this->is_tax ) {
Note: See TracChangeset for help on using the changeset viewer.