WordPress Version: 6.1
/**
* Returns the term's parent's term ID.
*
* @since 3.1.0
*
* @param int $term_id Term ID.
* @param string $taxonomy Taxonomy name.
* @return int|false Parent term ID on success, false on failure.
*/
function wp_get_term_taxonomy_parent_id($term_id, $taxonomy)
{
$term = get_term($term_id, $taxonomy);
if (!$term || is_wp_error($term)) {
return false;
}
return (int) $term->parent;
}