WordPress.org

Make WordPress Core

Ticket #23326: 23326.diff

File 23326.diff, 1.3 KB (added by ryan, 5 years ago)
  • wp-includes/taxonomy.php

     
    12401240        // $args can be whatever, only use the args defined in defaults to compute the key
    12411241        $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
    12421242        $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key );
    1243         $last_changed = wp_cache_get('last_changed', 'terms');
    1244         if ( !$last_changed ) {
    1245                 $last_changed = time();
    1246                 wp_cache_set('last_changed', $last_changed, 'terms');
     1243        $last_changed = wp_cache_get( 'last_changed', 'terms' );
     1244        if ( ! $last_changed ) {
     1245                $last_changed = 1;
     1246                wp_cache_set( 'last_changed', $last_changed, 'terms' );
    12471247        }
    12481248        $cache_key = "get_terms:$key:$last_changed";
    12491249        $cache = wp_cache_get( $cache_key, 'terms' );
     
    26322632                do_action('clean_term_cache', $ids, $taxonomy);
    26332633        }
    26342634
    2635         wp_cache_set('last_changed', time(), 'terms');
     2635        if ( function_exists( 'wp_cache_incr' ) ) {
     2636                wp_cache_incr( 'last_changed', 1, 'terms' );
     2637        } else {
     2638                $last_changed = wp_cache_get( 'last_changed', 'terms' );
     2639                wp_cache_set( 'last_changed', $last_changed + 1, 'terms' );
     2640        }
    26362641}
    26372642
    26382643/**