Exclude Child Term Posts from Parent Term Archive
Okay, I’ve found an answer. Part of the issue was the missing array @goto10 mentioned, and the other part was that tax_query has required arguments. Here’s what I’m using so far: function exclude_children($wp_query) { if ( isset ( $wp_query->query_vars[‘custom_taxomony’] ) ) { $wp_query->set(‘tax_query’, array( array ( ‘taxonomy’ => ‘custom_taxonomy’, ‘field’ => ‘slug’, ‘terms’ => $wp_query->query_vars[‘custom_taxonomy’], … Read more