Wordpress current taxonomy
function current_id_for_color()
{
global $wp_query;
global $pos;
$current_id = get_the_ID();
if( is_home() ){
$current_id = get_option( 'page_for_posts' );
}elseif( is_tax() ){
$value = $wp_query->query_vars['taxonomy'];
$current_term = get_term_by( 'slug', $wp_query->query_vars[$value], $value );
$current_id = $value.'_'.$current_term->term_id;
}elseif( is_tag() ){
$current_term = get_term_by( 'slug', $wp_query->query_vars['tag'], 'post_tag' );
$current_id = 'post_tag_'.$current_term->term_id;
}
return $current_id;
}