Because of this there is currently no possibility to exclude the children using the Query Loop (without using the query_vars hook to fix the tax_query) – the children are always included.
If you leave the option disabled in Bricks the query parameter is omitted which results in WP’s default value being used. Which is true.
If you enable the option in Bricks the query parameter is explicitly added with a value of true.
Thank you so much for the detailed explanation.
Understand the problem.
Seems like the Include children should change to Exclude children (set false to include_children param) will be making more sense, agree?
In my opinion it would be the „most correct“ way (looking at the official WP_Query documentation) to have the switch in Bricks being enabled by default. In this case the include_children parameter would not have to be included in the generated query at all since it is the default WP_Query behavior to include the children.
Only if the Bricks user then disables the toggle explicitly the parameter should be included in the query with a value of false.
Reading your answer again… it is the same as mine. Just switching from include to exclude. So yes. Either way would work. Mine is just more of a 1:1 copy to the original behavior.
@timmse: Unfortunately the fix in 1.7 does not seem to work because the include_children value is passed to the query as a string (“true” / “false”) instead of a boolean (true / false). Sorry for not noticing this earlier.
Using the query_vars hook things work as expected:
Would be good to simply enable a category__in option, as this only returns parent posts.
Breakdance has a query builder - it’s not nearly as good… BUT… it also has a text and array option, enabling you to manually enter the parameters, with almost identical syntax to wp_query.
This would be a lovely option for Bricks.