Make WordPress Core

Changeset 12510


Ignore:
Timestamp:
12/23/2009 02:37:21 PM (14 years ago)
Author:
ryan
Message:

Cleanup clean_term_cache(). Props Denis-de-Bernardy. see #11530

File:
1 edited

Legend:

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

    r12397 r12510  
    18611861    // If no taxonomy, assume tt_ids.
    18621862    if ( empty($taxonomy) ) {
    1863         $tt_ids = implode(', ', $ids);
     1863        $tt_ids = array_map('intval', $ids);
     1864        $tt_ids = implode(', ', $tt_ids);
    18641865        $terms = $wpdb->get_results("SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)");
     1866        $ids = array();
    18651867        foreach ( (array) $terms as $term ) {
    18661868            $taxonomies[] = $term->taxonomy;
     1869            $ids[] = $term->term_id;
    18671870            wp_cache_delete($term->term_id, $term->taxonomy);
    18681871        }
    18691872        $taxonomies = array_unique($taxonomies);
    18701873    } else {
    1871         foreach ( $ids as $id ) {
    1872             wp_cache_delete($id, $taxonomy);
    1873         }
    18741874        $taxonomies = array($taxonomy);
     1875        foreach ( $taxonomies as $taxonomy ) {
     1876            foreach ( $ids as $id ) {
     1877                wp_cache_delete($id, $taxonomy);
     1878            }
     1879        }
    18751880    }
    18761881
     
    18821887        wp_cache_delete('get', $taxonomy);
    18831888        delete_option("{$taxonomy}_children");
     1889        do_action('clean_term_cache', $ids, $taxonomy);
    18841890    }
    18851891
    18861892    wp_cache_set('last_changed', time(), 'terms');
    1887 
    1888     do_action('clean_term_cache', $ids, $taxonomy);
    18891893}
    18901894
Note: See TracChangeset for help on using the changeset viewer.