Changeset 37184
- Timestamp:
- 04/12/2016 08:36:31 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/class-wp-tax-query.php (modified) (1 diff)
-
tests/phpunit/tests/query/taxQuery.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-tax-query.php
r35916 r37184 441 441 $clause['alias'] = $alias; 442 442 443 $join .= " INNERJOIN $wpdb->term_relationships";443 $join .= " LEFT JOIN $wpdb->term_relationships"; 444 444 $join .= $i ? " AS $alias" : ''; 445 445 $join .= " ON ($this->primary_table.$this->primary_id_column = $alias.object_id)"; -
trunk/tests/phpunit/tests/query/taxQuery.php
r35242 r37184 408 408 409 409 $this->assertEqualSets( array( $p1, $p3 ), $q->posts ); 410 } 411 412 /** 413 * @ticket 36343 414 */ 415 public function test_tax_query_operator_not_exists_combined() { 416 register_post_type( 'wptests_cpt1' ); 417 register_taxonomy( 'wptests_tax1', 'wptests_cpt1' ); 418 register_taxonomy( 'wptests_tax2', 'wptests_cpt1' ); 419 420 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 421 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 422 $t3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 423 424 $p1 = self::factory()->post->create( array( 'post_type' => 'wptests_cpt1' ) ); 425 $p2 = self::factory()->post->create( array( 'post_type' => 'wptests_cpt1' ) ); 426 $p3 = self::factory()->post->create( array( 'post_type' => 'wptests_cpt1' ) ); 427 $p4 = self::factory()->post->create( array( 'post_type' => 'wptests_cpt1' ) ); 428 429 wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' ); 430 wp_set_object_terms( $p2, array( $t2 ), 'wptests_tax1' ); 431 wp_set_object_terms( $p3, array( $t3 ), 'wptests_tax2' ); 432 433 $q = new WP_Query( array( 434 'post_type' => 'wptests_cpt1', 435 'fields' => 'ids', 436 'tax_query' => array( 437 'relation' => 'OR', 438 array( 439 'taxonomy' => 'wptests_tax1', 440 'operator' => 'NOT EXISTS', 441 ), 442 array( 443 'taxonomy' => 'wptests_tax1', 444 'field' => 'slug', 445 'terms' => get_term_field( 'slug', $t1 ), 446 ), 447 ), 448 ) ); 449 450 unregister_post_type( 'wptests_cpt1' ); 451 unregister_taxonomy( 'wptests_tax1' ); 452 unregister_taxonomy( 'wptests_tax2' ); 453 454 $this->assertEqualSets( array( $p1, $p3, $p4 ), $q->posts ); 410 455 } 411 456
Note: See TracChangeset
for help on using the changeset viewer.