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