Changeset 17251 for trunk/wp-includes/query.php
- Timestamp:
- 01/11/2011 06:56:59 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r17246 r17251 2144 2144 // Back-compat 2145 2145 if ( !empty($this->tax_query->queries) ) { 2146 $tax_query_in = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'IN' ));2147 if ( !empty( $tax_query_in ) ) {2146 $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' ); 2147 if ( !empty( $tax_query_in_and ) ) { 2148 2148 if ( !isset( $q['taxonomy'] ) ) { 2149 foreach ( $tax_query_in as $a_tax_query ) {2149 foreach ( $tax_query_in_and as $a_tax_query ) { 2150 2150 if ( !in_array( $a_tax_query['taxonomy'], array( 'category', 'post_tag' ) ) ) { 2151 2151 $q['taxonomy'] = $a_tax_query['taxonomy']; … … 2160 2160 } 2161 2161 2162 $cat_query = wp_list_filter( $tax_query_in , array( 'taxonomy' => 'category' ) );2162 $cat_query = wp_list_filter( $tax_query_in_and, array( 'taxonomy' => 'category' ) ); 2163 2163 if ( !empty( $cat_query ) ) { 2164 2164 $cat_query = reset( $cat_query ); 2165 $ cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' );2166 if ( $ cat ) {2167 $this->set( 'cat', $ cat->term_id );2168 $this->set( 'category_name', $ cat->slug );2165 $the_cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' ); 2166 if ( $the_cat ) { 2167 $this->set( 'cat', $the_cat->term_id ); 2168 $this->set( 'category_name', $the_cat->slug ); 2169 2169 } 2170 unset( $the_cat ); 2170 2171 } 2172 unset( $cat_query ); 2173 2174 $tag_query = wp_list_filter( $tax_query_in_and, array( 'taxonomy' => 'post_tag' ) ); 2175 if ( !empty( $tag_query ) ) { 2176 $tag_query = reset( $tag_query ); 2177 $the_tag = get_term_by( $tag_query['field'], $tag_query['terms'][0], 'post_tag' ); 2178 if ( $the_tag ) { 2179 $this->set( 'tag_id', $the_tag->term_id ); 2180 } 2181 unset( $the_tag ); 2182 } 2183 unset( $tag_query ); 2171 2184 } 2172 2185 } … … 2845 2858 2846 2859 if ( $this->is_category || $this->is_tag || $this->is_tax ) { 2847 $tax_query_in = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'IN' ));2848 2849 $query = reset( $tax_query_in );2860 $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' ); 2861 2862 $query = reset( $tax_query_in_and ); 2850 2863 2851 2864 if ( 'term_id' == $query['field'] )
Note: See TracChangeset
for help on using the changeset viewer.