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();

?>

0 Comments

You must be logged in to post a comment.