Make WordPress Core


Ignore:
Timestamp:
09/14/2023 12:38:04 PM (9 months ago)
Author:
spacedmonkey
Message:

Taxonomy: Introduce 'cache_results' parameter to WP_Term_Query for bypassing query caching.

Incorporating a new 'cache_results' parameter into the WP_Term_Query class, this commit empowers developers with the ability to bypass query caches, explicitly triggering database queries when needed. This brings the WP_Term_Query class inline with WP_Query and WP_User_Query that already have a 'cache_results' parameter.

Update the term_exists function to use this new parameter, so the term query caches are not used while importing.

Props dlh, spacedmonkey, peterwilsoncc.
Fixes #52710.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r56549 r56585  
    15421542    // Ensure that while importing, queries are not cached.
    15431543    if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
    1544         // @todo Disable caching once #52710 is merged.
    1545         $defaults['cache_domain'] = microtime();
     1544        $defaults['cache_results'] = false;
    15461545    }
    15471546
Note: See TracChangeset for help on using the changeset viewer.