I want to get the categories listed in hierarchical order. But this code is returning my categories in alphabetical order, and ignoring the hierarchy. Any help?
$categories = get_categories("hierarchical=1");
foreach ($categories as $cat) {
echo "<p>".$cat->cat_name."</p>";
}
I'm pretty confident that this code is correct. I'm tempted to call this a bug. I've also tried:
$categories = get_categories("hierarchical=true");
foreach ($categories as $cat) {
echo "<p>".$cat->cat_name."</p>";
}
and:
$parameters = array('type' => 'post',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => false,
'include_last_update_time' => false,
'hierarchical' => 1,
'pad_counts' => false);
$categories = get_categories($parameters);
foreach ($categories as $cat) {
echo "<p>".$cat->cat_name."</p>";
}