Created
April 23, 2014 13:36
-
-
Save ivandoric/11215439 to your computer and use it in GitHub Desktop.
wordpress: Get parent category of custom taxonomy in 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 $terms = get_the_terms( $post->ID , 'product-category' ); | |
if ( $terms != null ){ | |
foreach( $terms as $term ) { | |
if($term->parent == 0){ | |
$theterm = $term->slug; | |
} | |
unset($term); | |
} } | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment