get_term_children() and category query fixes.

git-svn-id: https://develop.svn.wordpress.org/trunk@5593 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-05-29 21:27:49 +00:00
parent e0bf0ffa02
commit cfa5ecfd4b
2 changed files with 36 additions and 22 deletions
+16
View File
@@ -656,6 +656,22 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT) {
}
}
function get_term_children( $term, $taxonomy ) {
$terms = _get_term_hierarchy($taxonomy);
if ( ! isset($terms[$term]) )
return array();
$children = $terms[$term];
foreach ( $terms[$term] as $child ) {
if ( isset($terms[$child]) )
$children = array_merge($children, get_term_children($child, $taxonomy));
}
return $children;
}
function clean_term_cache($ids, $taxonomy) {
if ( !is_array($ids) )
$ids = array($ids);