Make WordPress Core


Ignore:
Timestamp:
02/03/2022 05:41:46 PM (2 years ago)
Author:
spacedmonkey
Message:

Taxonomy: Remove cache expiry limitation in WP_Term_Query.

Remove the one day expiry limitation from query caches found in the WP_Term_Qurery class. Removing this limitation means that the caches will remain in object caching, as long as possible. Ensure that all term / taxonomy cache clear functions invalidate query caches, by deleting the last_changed value in the terms cache group.

Props spacedmonkey, adamsilverstein, boonebgorges, tillkruess, dlh, flixos90.
Fixes #54511.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-term-query.php

    r52332 r52669  
    776776
    777777        if ( empty( $terms ) ) {
    778             wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS );
     778            wp_cache_add( $cache_key, array(), 'terms' );
    779779            return array();
    780780        }
     
    881881        }
    882882
    883         wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS );
     883        wp_cache_add( $cache_key, $terms, 'terms' );
    884884
    885885        if ( 'all' === $_fields || 'all_with_object_id' === $_fields ) {
Note: See TracChangeset for help on using the changeset viewer.