get_categories hierarchy=1 not working
-
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>"; }
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘get_categories hierarchy=1 not working’ is closed to new replies.