Skip to content

Instantly share code, notes, and snippets.

@simonlk
Created October 22, 2012 12:01
Show Gist options
  • Save simonlk/3931219 to your computer and use it in GitHub Desktop.
Save simonlk/3931219 to your computer and use it in GitHub Desktop.
Get the details of the current taxonomy. This is for Woocommerce categories but would work for any custom taxonomies
<?php
$current_tax = get_query_var( 'product_cat' );
$term =get_term_by( 'slug', $current_tax, 'product_cat');
$term_name = $term->name;
$term_id = $term->term_id;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment