Last active
June 16, 2016 07:13
-
-
Save chodorowicz/685137b973723b93ada2a7d150fc433c to your computer and use it in GitHub Desktop.
get term ultimate parent / WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_term_ultimate_parent($id, $taxonomy) { | |
$ancestors = get_ancestors($id, $taxonomy); | |
return get_term(end($ancestors), $taxonomy); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment