WordPress.org

Make WordPress Core

Ticket #16703: 16703.diff

File 16703.diff, 725 bytes (added by scribu, 7 years ago)

check is_singular before altering query

  • wp-includes/query.php

     
    21472147                $search = apply_filters_ref_array('posts_search', array( $search, &$this ) );
    21482148
    21492149                // Taxonomies
    2150                 $this->parse_tax_query( $q );
     2150                if ( !$this->is_singular ) {
     2151                        $this->parse_tax_query( $q );
    21512152
    2152                 $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
     2153                        $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
    21532154
    2154                 $join .= $clauses['join'];
    2155                 $where .= $clauses['where'];
     2155                        $join .= $clauses['join'];
     2156                        $where .= $clauses['where'];
     2157                }
    21562158
    21572159                if ( $this->is_tax ) {
    21582160                        if ( empty($post_type) ) {