Found this answer that gives you the first prototype of the ancestor. It can be easily changed to give you a name.
Got it here: http://nick.boldison.com/wordpress/wordpress-get-top-level-parent-category/
<?php // get parent category slug $parentCatList = get_category_parents($cat,false,','); $parentCatListArray = split(",",$parentCatList); $topParentName = $parentCatListArray[0]; $sdacReplace = array(" " => "-", "(" => "", ")" => ""); $topParent = strtolower(strtr($topParentName,$sdacReplace)); ?>
In fact, to get the parent name:
// get parent category slug $parentCatList = get_category_parents($cat,false,','); $parentCatListArray = split(",",$parentCatList); $topParentName = $parentCatListArray[0];
source share