As @Milo’s pointer said, this:
- Sadly, is normal WordPress behaviour.
- Can be suppressed using
parse_tax_query
andinclude_children
set at0
…
The code found in the answer at https://wordpress.stackexchange.com/a/202773/39300 Works for me…
function taxonomy_archive_exclude_children($query){
$taxonomy_slugs = ['product_category', 'application_category'];
if($query->is_main_query() && is_tax($taxonomy_slugs)){
foreach($query->tax_query->queries as &$tax_query_item){
if(empty($taxonomy_slugs) || in_array($tax_query_item['taxonomy'], $taxonomy_slugs)){
$tax_query_item['include_children'] = 0;
}
}
}
}
add_action('parse_tax_query', 'taxonomy_archive_exclude_children');
// An empty $taxonomy_slugs array will exclude children for all taxonomy archives.
parse_tax_query
fires at taxonomy time, include_children
0 is where I can deny children from appearing.