For anyone visiting this topic in the future, I will form an answer of my comment.
The reason for this issue was the use of $category
inside the tax_query
. The get_terms
function return terms as entire objects by default. The tax_query
expects an ID (or an array of IDs). This caused issues with the execution of the tax_query
.
For anyone having the same problem, make sure your only including your term IDs. So this:
'tax_query' => array(
array(
'taxonomy' => 'soort-event',
'terms' => $category,
'field' => 'term_id'
)
)
Becomes this:
'tax_query' => array(
array(
'taxonomy' => 'soort-event',
'terms' => array($category->term_id),
'field' => 'term_id'
)
)
More about get_terms
: https://developer.wordpress.org/reference/functions/get_terms/
More about tax_query
: https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters