I have a custom post type called 'product' with a registered taxonomy 'product-type'.
I want to display all post from a particular taxonomy from custom post type. In my case I want to display all the posts from 'product' post type with a term of 'software'.
<?php $args = array(
'post_type' => 'product',
'tax_query' => array(
'taxonomy' => 'product-type',
'terms' => array('software'),
'field' => 'slug'
),
'posts_per_page' => 9,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$query = new WP_Query( $args ); ?>
<ul class="list-products clearfix">
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
This is producing me no results. It's empty.
But if I remove the entire tax_query from $arg
'tax_query' => array(
'taxonomy' => 'product-type',
'terms' => array('software'),
'field' => 'slug'
),
Everything works fine. I get all the posts from 'product' custom post type.