Exclude child term posts from parent term archive page
-
For the past weeks I’ve been searching for a solution to exclude child term posts on the parent term archive page. I’ve tried several solutions without success. Is there any best practice for this?
I found this code, but since my php skills are none existing I have not been able to solve the syntax errors this produces:
$parent_posts = get_posts(array( 'tax_query' => array( array( 'taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $parent_term, 'include_children' => 0 ) ), 'post_type' => $post_type ));
Any ideas?
- The topic ‘Exclude child term posts from parent term archive page’ is closed to new replies.