Advanced Tax Query

$args = array(
'post_type' => 'actions',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
//'relation' => 'AND',
array(
'taxonomy' => 'actions_difficulty_levels',
'field' => 'slug',
'terms' => array($term)
),
array(
'taxonomy' => 'actions_tags',
'field' => 'slug',
'terms' => array('rebate'),
//'operator' => 'NOT IN'
)
)
);
$actions = get_posts($args);

Tag cloud highlighting

<?php

function wco_current_term_highlight($cloud){
if(!is_tax('wco_category')) return $cloud;
$wco_categories = get_terms('wco_category');
if($wco_categories === false) return $cloud;
foreach($wco_categories as $category) if(is_tax('wco_category',$category->slug)) $cloud = str_replace("tag-link-$category->term_id", "current-term tag-link-$category->term_id",$cloud);
return $cloud;
}
add_filter('wp_tag_cloud','wco_current_term_highlight');

?>

Taxonomy in custom post column

<?php

/* Add Columns */
function wco_add_columns($defaults){
if($_GET['post_type'] != 'wco_vendor') return $defaults;
$defaults['wco_region'] = __('Region');
return $defaults;
}

/* Get Column Data */
function wco_get_column_data($column,$id){
switch($column){
case 'wco_region':
wco_term_links($id,'wco_region');
break;
}
}

/* Term Links */
function wco_term_links($id,$taxonomy){
$terms = wp_get_object_terms($id,$taxonomy);
$count = count($terms);
$i = 1;
if($count > 0){
foreach($terms as $term){?>
<a href="/wp-admin/edit-tags.php?action=edit&taxonomy=<?php echo $taxonomy . '&tag_ID=' . $term->term_id ?>&post_type=wco_vendor"><?php echo $term->name ?></a><?php if($i < $count) echo ','; $i++ ?>
<?php
}
}
}

add_filter('manage_wco_vendor_posts_columns','wco_add_columns');
add_action('manage_wco_vendor_posts_custom_column','wco_get_column_data',10,2);
?>

Query by term and custom field

<?php
$query = "
SELECT * FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id)
LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)
LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)
WHERE $wpdb->terms.slug = 'tvlt-notes'
AND $wpdb->term_taxonomy.taxonomy = 'tvlt_category'
AND $wpdb->postmeta.meta_key = 'tvlt_sort'
AND $wpdb->postmeta.meta_value <> '9999'
";

$tvlt_posts = $wpdb->get_results($query, OBJECT);
?>

Query for custom post taxonomy

<?php

$args = array(
'post_type' => 'my_custom_post_type',
'tax_query' => array(
array(
'taxonomy' => 'my_taxonomy',
'field' => 'slug',
'terms' => 'my_custom_category_or_term'
)
)
);
$the_query = new WP_query();
$the_query->query($args);

if($the_query->have_posts()):while($the_query->have_posts()):$the_query->the_post();

//Loop Content

endwhile; endif;
wp_reset_query();

?>

Create category term

//Initilize Plugin
if(!is_term("WP Videos", "category")){
$arg = array('description' => "Main category for all of the WP Video Player videos", 'parent' => 3);
$new_cat_id = wp_insert_term("WP Videos", "category", $arg);
}

Custom field to taxonomy

$brand_name = get_post_meta($post->ID, 'Brand Name', true);

//Brand Meta
$object_term = wp_get_object_terms($post->ID, 'brand');
$object = $object_term[0];
$current_brand = $object->name;

if($current_brand =='' && $brand_name !=''){
wp_set_object_terms($post->ID,$brand_name,'brand');
} else /*Do Nothing*/;

Taxonomy Hook

add_action( wp_insert_post, 'set_brand');

function set_brand($postid){
$brand_name = get_post_meta($postid, 'Brand Name', true);
wp_set_object_terms($postid,$brand_name,'brand');
}