Make sure cache is primed before use in get_category_children().
git-svn-id: http://svn.automattic.com/wordpress/trunk@2608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
434ee3acd5
commit
8788a9bd9e
|
@ -123,16 +123,20 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_category_children($id, $before = '/', $after = '') {
|
function get_category_children($id, $before = '/', $after = '') {
|
||||||
global $cache_categories;
|
global $cache_categories;
|
||||||
$c_cache = $cache_categories; // Can't do recursive foreach on a global, have to make a copy
|
|
||||||
$chain = '';
|
if ( ! isset($cache_categories))
|
||||||
foreach ($c_cache as $category){
|
update_category_cache();
|
||||||
if ($category->category_parent == $id){
|
|
||||||
$chain .= $before.$category->cat_ID.$after;
|
$c_cache = $cache_categories; // Can't do recursive foreach on a global, have to make a copy
|
||||||
$chain .= get_category_children($category->cat_ID, $before, $after);
|
$chain = '';
|
||||||
}
|
foreach ($c_cache as $category){
|
||||||
}
|
if ($category->category_parent == $id){
|
||||||
return $chain;
|
$chain .= $before.$category->cat_ID.$after;
|
||||||
|
$chain .= get_category_children($category->cat_ID, $before, $after);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $chain;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated.
|
// Deprecated.
|
||||||
|
|
Loading…
Reference in New Issue