How to get just the top most parent category?
-
Hello,
I am using this code:
<?php $category = get_the_category(); echo $category[0]->category_nicename;?>
Which works fine, but it gets me the lowest category associated with the post. How would I change it to get me the top most parent category?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to get just the top most parent category?’ is closed to new replies.