clean_term_cache [ WordPress Function ]
clean_term_cache ( $ids, $taxonomy = '', $clean_taxonomy = true )
| Parameters: |
|
| Uses: |
|
| Defined at: |
|
Soorgelijke functies: clean_user_cache, clean_category_cache, clean_object_term_cache, clean_page_cache, clean_post_cache
Will remove all of the term ids from the cache.
Source
<?php
function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true) {
global $wpdb;
static $cleaned = array();
if ( !is_array($ids) )
$ids = array($ids);
$taxonomies = array();
// If no taxonomy, assume tt_ids.
if ( empty($taxonomy) ) {
$tt_ids = array_map('intval', $ids);
$tt_ids = implode(', ', $tt_ids);
$terms = $wpdb->get_results("SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)");
$ids = array();
foreach ( (array) $terms as $term ) {
$taxonomies[] = $term->taxonomy;
$ids[] = $term->term_id;
wp_cache_delete($term->term_id, $term->taxonomy);
}
$taxonomies = array_unique($taxonomies);
} else {
$taxonomies = array($taxonomy);
foreach ( $taxonomies as $taxonomy ) {
foreach ( $ids as $id ) {
wp_cache_delete($id, $taxonomy);
}
}
}
foreach ( $taxonomies as $taxonomy ) {
if ( isset($cleaned[$taxonomy]) )
continue;
$cleaned[$taxonomy] = true;
if ( $clean_taxonomy ) {
wp_cache_delete('all_ids', $taxonomy);
wp_cache_delete('get', $taxonomy);
delete_option("{$taxonomy}_children");
// Regenerate {$taxonomy}_children
_get_term_hierarchy($taxonomy);
}
do_action('clean_term_cache', $ids, $taxonomy);
}
wp_cache_set('last_changed', time(), 'terms');
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- clean_term_cache Wordpress hook details -- Adam Brown, BYU ...
Detailed information about every action hook and filter used in WordPress. Makes Plugin API easier to use. Lists appearance, file location, and deprecation data ...
adambrown.info - categories - Calling clean_term_cache() fails when called in the ...
Apr 19, 2011 ... Interestingly, if I create a plugin whose sole function is to execute the clean_term_cache('','category') call, it fixes the problem and creates the ...
wordpress.stackexchange.com - PHPXRef 0.7 : WordPress : Function Reference: clean_term_cache()
Function and Method Cross Reference. clean_term_cache(). Defined at: /wp- includes/taxonomy.php -> line 2546. Referenced 6 times: ...
phpxref.ftwr.co.uk - clean_term_cache | A HitchHackers guide through WordPress
Feb 11, 2011 ... function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true) { global $wpdb; static $cleaned = array(); if ( !is_array($ids) ) $ids ...
hitchhackerguide.com