In the next reading WordPress source, a lot of harvest. In the following function, "If no taxonomy, assume Tt_ids" why? A contradiction, huh? Is it empty, where does the term_id? is both empty and how do I choose from table term_taxonomy?
Please master pointing twos send by.
/**
* Would remove all of the term IDs from the cache.
*
* @since 2.3.0
* @uses $wpdb
*
* @param int|array $ids Single or list of the term IDs
* @param string $taxonomy Can be empty and would assume tt_ids, else would use a for context.
* @param bool $clean _taxonomy Whether to clean taxonomy wide caches (true), or just individual term object caches (false). Default is true.
*/
function Clean_term_cache ($ids, $taxonomy = ", $clean _taxonomy = True) {
Global $wpdb;
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 ($clean _taxonomy) {
Wp_cache_delete (' All_ids ', $taxonomy);
Wp_cache_delete (' Get ', $taxonomy);
Delete_option ("{$taxonomy}_children");
Regenerate {$taxonomy}_children
_get_term_hierarchy ($taxonomy);
}
/**
* Fires once after each taxonomy's term cache have been cleaned.
*
* @since 2.5.0
*
* @param array $ids An array of term IDs.
* @param string $taxonomy taxonomy slug.
*/
Do_action (' Clean_term_cache ', $ids, $taxonomy);
}
Wp_cache_set (' last_changed ', Microtime (), ' terms ');
}
Reply to discussion (solution)
If no taxonomy, assume tt_ids--if the parameter taxonomy is empty, we assume that the parameter ID is tt_ids----term_taxonomy table
term_taxonomy_id. Otherwise, it is considered term_id.
If $taxonomy (category name) is empty
The category name corresponding to the $ids (class number)
Because the subsequent search is based on the classification name