I want a multi-dimensional array of my categories.
function get_category_array()
{
$args = array(
'type' => 'post',
'child_of' => 0,
'hide_empty' => false,
'hierarchical' => true,
'exclude' => '1'
);
return get_categories($args);
}
The above function is returning a "flat" list of all of the categories like this (instead of a parent->child->grandchild->etc.. array)
Array
(
[0] => stdClass Object
(
[term_id] => 210
[name] => Cat 1 Name
[slug] => cat-1-name
[term_group] => 0
[term_taxonomy_id] => 211
[taxonomy] => category
[description] =>
[parent] => 208
[count] => 0
[cat_ID] => 210
[category_count] => 0
[category_description] =>
[cat_name] => Cat 1 Name
[category_nicename] => cat-1-name
[category_parent] => 208
)
[1] => stdClass Object
(
[term_id] => 234
[name] => Cat 2 Name
[slug] => cat-2-name
[term_group] => 0
[term_taxonomy_id] => 237
[taxonomy] => category
[description] =>
[parent] => 167
[count] => 0
[cat_ID] => 234
[category_count] => 0
[category_description] =>
[cat_name] => Cat 2 Name
[category_nicename] => cat-2-name
[category_parent] => 167
)
)
Anybody know why this isn't working?