I have this $args for WP_Query:
$args = array(
'post_type' => 'estructura',
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'term_id',
'terms' => '12',
),
)
);
Witch returns the posts tagged with the category 12 or tagged with the childs categories ( of 12 )
I want only the ones tagged with category 12,
How can I prevent to return the childs?
Thanks!
I was able to solve this problem using the
include_children
optionWhen you use
tax_query
, it’s getting all of the children as they have the parent’s url in their URL (e.g. website.com/category_name/child_1/).This should work fine. Source: https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters