Forum Replies Created

Viewing 1 replies (of 1 total)
  • I had the same issue but found a way how to get it done:

    $the_cat = get_the_category();
    	foreach($the_cat as $category) {
    		$category = $category->cat_ID;
    		$category = array($category,'');
    			foreach($category as $cat){
    				if(cat_is_ancestor_of($parentid,$cat)) {
    // your code goes in here
    								}
    			}
    }

    Just replace $parentid with the ID you want to be the parent.

Viewing 1 replies (of 1 total)