Support » How-To and Troubleshooting » how do i get the top level cateogry name?
7 years, 10 months ago
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->category_parent);
While this seems to work for the first child in the tree any below show up blank.
Thanks in advance for your help!
The depth=1 parameter with the template tag, wp_list_bookmarks(), will display all ‘top level’ cats.