Make sure it's an array first.
git-svn-id: https://develop.svn.wordpress.org/trunk@2739 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9a3dfe5815
commit
c37be4f535
|
@ -391,12 +391,14 @@ function get_nested_categories($default = 0, $parent = 0) {
|
||||||
$cats = return_categories_list($parent);
|
$cats = return_categories_list($parent);
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
|
if ( is_array( $cats ) ) {
|
||||||
foreach($cats as $cat) {
|
foreach($cats as $cat) {
|
||||||
$result[$cat]['children'] = get_nested_categories($default, $cat);
|
$result[$cat]['children'] = get_nested_categories($default, $cat);
|
||||||
$result[$cat]['cat_ID'] = $cat;
|
$result[$cat]['cat_ID'] = $cat;
|
||||||
$result[$cat]['checked'] = in_array($cat, $checked_categories);
|
$result[$cat]['checked'] = in_array($cat, $checked_categories);
|
||||||
$result[$cat]['cat_name'] = get_the_category_by_ID($cat);
|
$result[$cat]['cat_name'] = get_the_category_by_ID($cat);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue