Return to Snippet

Revision: 40000
at January 24, 2011 22:20 by widescape


Initial Code
function get_root_category($category)
{
  $category = is_object($category) ? $category : get_category($category);
  while ($category->parent > 0) $category = get_category($category->parent);
  return $category;
}

Initial URL

                                

Initial Description

                                

Initial Title
Wordpress Get Root Category

Initial Tags
wordpress, category

Initial Language
PHP