I’m trying to filter based on a tax_query filter in WordPress but it doesnt give the right data back.
$args = array(
'post_type' => 'cpt_zorgverleners',
'post_status' => 'publish',
'posts_per_page' => 12,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'cat_typezorg',
'field' => 'slug',
'terms' => array('dietist','apotheker'),
'operator' => 'AND'
)
),
'orderby' => 'title'
);
It does work when I remove the "operator AND" but I need that filter. With the operator AND it works with all the child taxonomies but not with the parent taxonomies. And without it it works fine but it functions like an OR operator and I don’t want that.
Whats wrong with this? why doesnt it work with the parent taxonomies?
2
Answers
Got it.. This was my fix:
only problem is I cant mix AND/OR now.. not needed but how do i do that?
You use only one array in tex_query then remove "relation" from tex_query