Support » Fixing WordPress » how do i get the top level cateogry name?

  • I am trying to print out the name of the top level categories. i have some categories that have 10 children. the code i am using is the following.

    $category = get_the_category();
    $current_category = get_cat_name($category[0]->category_parent);
    echo $current_category;

    While this seems to work for the first child in the tree any below show up blank.

    Thanks in advance for your help!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘how do i get the top level cateogry name?’ is closed to new replies.