not category_parent but category_grandparent
-
how do i detect if the grandparent of a category is a certain category
so i have
at the top level a category called ‘location’ (7)
then i have a child category called ‘australia’
then inside australia i have ‘sydney’when i tick ‘sydney’ i want to detact if it is a grandchild of ‘location’
sort of like:
foreach((get_the_category()) as $cat){
if ($cat->category_parent == 7){ echo $cat->cat_name;
}
}but with “$cat->category_grandparent” instead.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘not category_parent but category_grandparent’ is closed to new replies.