Revision: 52854
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 3, 2011 01:40 by adamturtle
Initial Code
function get_cat_hierchy($parent,$args){ $cats = get_categories($args); $ret = new stdClass; foreach($cats as $cat){ if($cat->parent==$parent){ $id = $cat->cat_ID; $ret->$id = $cat; $ret->$id->children = get_cat_hierchy($id,$args); } } return $ret; }
Initial URL
http://wordpress.org/support/topic/get_categories-hierarchy-not-working
Initial Description
Returns Wordpress categories as a hierarchical object (i.e. categories with subcategories)
Initial Title
Wordpress category hierarchy
Initial Tags
php, wordpress
Initial Language
PHP