Created
February 24, 2015 08:50
-
-
Save nickkuijpers/d3f5723c9f7016f29369 to your computer and use it in GitHub Desktop.
Wordpress PHP Get current product category
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
global $post; | |
$terms = get_the_terms( $post->ID, 'product_cat' ); | |
foreach ($terms as $term){ | |
$product_cat_id = $term->term_id; | |
$product_cat_name = $term->name; | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment