Make WordPress Core


Ignore:
Timestamp:
05/26/2007 11:32:06 PM (19 years ago)
Author:
ryan
Message:

Term cache work. see #4189

File:
1 edited

Legend:

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

    r5553 r5555  
    9696    $term_id = apply_filters('term_id_filter', $term_id, $tt_id);
    9797
    98     //clean_term_cache($term_id);
     98    clean_term_cache($term_id, $taxonomy);
    9999
    100100    do_action("created_term", $term_id, $tt_id);
     
    147147    $wpdb->query("DELETE FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = '$tt_id'");
    148148
    149     //clean_term_cache($term, $taxonomy);
     149    clean_term_cache($term, $taxonomy);
     150
    150151    do_action("delete_$taxonomy", $term, $tt_id);
    151152
     
    210211    $term_id = apply_filters('term_id_filter', $term_id, $tt_id);
    211212
    212     //clean_term_cache($term_id);
     213    clean_term_cache($term_id, $taxonomy);
    213214
    214215    do_action("edited_term", $term_id, $tt_id);
     
    510511
    511512    $cache[ $key ] = $terms;
    512     wp_cache_add( 'get_terms', $cache, 'terms' );
     513    wp_cache_add( 'get_terms', $cache, 'term' );
    513514
    514515    $terms = apply_filters('get_terms', $terms, $taxonomies, $args);
     
    583584}
    584585
     586function clean_term_cache($id, $taxonomy) {
     587    wp_cache_delete($id, $taxonomy);
     588    wp_cache_delete('all_ids', $taxonomy);
     589    wp_cache_delete('get', $taxonomy);
     590    delete_option("{$taxonomy}_children");
     591    wp_cache_delete('get_terms', 'terms');
     592}
     593
    585594function _get_term_hierarchy($taxonomy) {
    586595    // TODO Make sure taxonomy is hierarchical
Note: See TracChangeset for help on using the changeset viewer.