Changeset 55759
- Timestamp:
- 05/16/2023 12:29:34 PM (19 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r55703 r55759 2193 2193 * 'all_with_object_id', an array of `WP_Term` objects will be returned. 2194 2194 * @since 4.7.0 Refactored to use WP_Term_Query, and to support any WP_Term_Query arguments. 2195 * @since 6.3.0 Passing `update_term_meta_cache` argument value false by default resulting in get_terms() to not 2196 * prime the term meta cache. 2195 2197 * 2196 2198 * @param int|int[] $object_ids The ID(s) of the object(s) to retrieve. … … 2221 2223 $object_ids = array_map( 'intval', $object_ids ); 2222 2224 2223 $args = wp_parse_args( $args ); 2225 $defaults = array( 2226 'update_term_meta_cache' => false, 2227 ); 2228 2229 $args = wp_parse_args( $args, $defaults ); 2224 2230 2225 2231 /** -
trunk/tests/phpunit/tests/term/getTheTerms.php
r55745 r55759 196 196 /** 197 197 * @ticket 36814 198 */ 199 public function test_uncached_terms_should_be_primed_with_a_single_query() { 198 * @ticket 57701 199 */ 200 public function test_uncached_terms_should_not_be_primed_with_a_single_query_by_default() { 200 201 register_taxonomy( 'wptests_tax', 'post' ); 201 202 … … 214 215 $this->assertSameSets( $terms, wp_list_pluck( $found, 'term_id' ) ); 215 216 216 $num_queries++; 217 $this->assertSame( $num_queries, get_num_queries() ); 218 217 // Two extra queries are expected as the cache is not primed and hence terms need to be queried. 218 $this->assertSame( 1, get_num_queries() - $num_queries ); 219 219 } 220 220 -
trunk/tests/phpunit/tests/term/wpGetObjectTerms.php
r55745 r55759 615 615 /** 616 616 * @ticket 10142 617 */ 618 public function test_termmeta_cache_should_be_lazy_loaded_by_default() { 617 * @ticket 57701 618 */ 619 public function test_termmeta_cache_should_not_be_lazy_loaded_by_default() { 619 620 register_taxonomy( 'wptests_tax', 'post' ); 620 621 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); … … 634 635 } 635 636 636 $this->assertSame( $num_queries + 1, get_num_queries() ); 637 // Here we had extra queries as the term meta cache was not primed by default. 638 $this->assertSame( 3, get_num_queries() - $num_queries ); 637 639 } 638 640
Note: See TracChangeset
for help on using the changeset viewer.