I want to display all post under a parent category (custom taxonomy) ONLY!.
Here's what I've done so far:'
<?php
$args_1 = array(
'fields' => 'ids',
);
$custom_taxterms = wp_get_object_terms(
$post->ID,
'product_type',
$args_1
);
$args_2 = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'product_type',
'field' => 'id',
'terms' => $custom_taxterms,
'include_children' => false,
),
),
'post__not_in' => array( $post->ID ),
);
$related_items = new WP_Query( $args_2 );
This displays all the posts including the sub categories, which I don't want to.
Thanks!!