question is simple (i don’t know is aswer too 😉
I just want to check that, does a category has child (or is ancestor) from its cat-id with a function.
Eg.
function check_category ($catid){
............
...//true if is ancestor, false if not
return $result;
}
Note: I can only pass cat-id parameter for function because i need to use it in functions.php
Thanks in advance…
Leave a Reply
You must be logged in to post a comment.
You can do something like this:
and use it like this:
Update:
to check the other way around (if a category has children) you can use get_categories
Have a look at the Codex: http://codex.wordpress.org/Function_Reference/get_category_parents