get_term_children() and category query fixes.

git-svn-id: http://svn.automattic.com/wordpress/trunk@5593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2007-05-29 21:27:49 +00:00
parent 6a314d85d8
commit 3176f1acd2
2 changed files with 36 additions and 22 deletions

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);