Last active
December 14, 2015 01:09
-
-
Save not-only-code/5003753 to your computer and use it in GitHub Desktop.
return only the top level terms of the object/s
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
/** | |
* get top level object terms | |
* @package default | |
* @version 1.0 | |
**/ | |
function _get_object_parent_terms ($object, $taxonomies, $args = array()) { | |
$object_terms = wp_get_object_terms($object, $taxonomies, $args); | |
$output = array(); | |
foreach ($object_terms as $object_term) | |
if ($object_term->parent == 0) | |
array_push($output, $object_term); | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment