Changeset 61048
- Timestamp:
- 10/22/2025 04:28:33 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
src/wp-includes/class-wp-term-query.php (modified) (2 diffs)
-
tests/phpunit/tests/post/query.php (modified) (1 diff)
-
tests/phpunit/tests/term/query.php (modified) (1 diff)
-
tests/phpunit/tests/user/query.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-term-query.php
r60697 r61048 471 471 $include = $args['include']; 472 472 473 $inclusions = '';474 473 if ( ! empty( $include ) ) { 475 474 $exclude = ''; 476 475 $exclude_tree = ''; 477 476 $inclusions = implode( ',', wp_parse_id_list( $include ) ); 478 } 479 480 if ( ! empty( $inclusions ) ) { 477 481 478 $this->sql_clauses['where']['inclusions'] = 't.term_id IN ( ' . $inclusions . ' )'; 482 479 } … … 816 813 817 814 if ( empty( $terms ) ) { 815 $this->terms = array(); 816 818 817 if ( $args['cache_results'] ) { 819 wp_cache_set_salted( $cache_key, array(), 'term-queries', $last_changed ); 820 } 821 return array(); 818 wp_cache_set_salted( $cache_key, $this->terms, 'term-queries', $last_changed ); 819 } 820 821 return $this->terms; 822 822 } 823 823 -
trunk/tests/phpunit/tests/post/query.php
r60729 r61048 780 780 781 781 /** 782 * @ticket 47719 783 */ 784 public function test_post__in_should_return_no_posts_when_0() { 785 self::factory()->post->create_many( 4 ); 786 787 $query = new WP_Query( 788 array( 789 'post_type' => 'post', 790 'post__in' => array( 0 ), 791 ) 792 ); 793 794 $this->assertSame( array(), $query->posts ); 795 $this->assertSame( 0, $query->found_posts ); 796 } 797 798 /** 782 799 * @ticket 57296 783 800 * @covers WP_Query::get_posts -
trunk/tests/phpunit/tests/term/query.php
r60729 r61048 1050 1050 1051 1051 $this->assertContains( $t1, $q->terms ); 1052 } 1053 1054 /** 1055 * @ticket 47719 1056 */ 1057 public function test_include_should_return_no_terms_when_0() { 1058 register_taxonomy( 'wptests_tax', 'post' ); 1059 1060 self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 1061 1062 $query = new WP_Term_Query( 1063 array( 1064 'taxonomy' => 'wptests_tax', 1065 'include' => array( 0 ), 1066 ) 1067 ); 1068 1069 $expected = array(); 1070 $this->assertSame( $expected, $query->terms ); 1071 $this->assertSame( $expected, $query->get_terms() ); 1052 1072 } 1053 1073 -
trunk/tests/phpunit/tests/user/query.php
r61037 r61048 1739 1739 // Make sure manually setting total_users doesn't get overwritten. 1740 1740 $this->assertSame( 1, $q->total_users ); 1741 } 1742 1743 /** 1744 * @ticket 47719 1745 */ 1746 public function test_include_should_return_no_users_when_0() { 1747 $query = new WP_User_Query( 1748 array( 1749 'role' => '', 1750 'include' => array( 0 ), 1751 ) 1752 ); 1753 1754 $this->assertSame( array(), $query->get_results() ); 1741 1755 } 1742 1756
Note: See TracChangeset
for help on using the changeset viewer.