Reputation: 21
I am trying to get posts from the specific term in twig file but it appears that tax_query is not working with timber I get all posts from the post_type. Anyone knows what the issue is?
{% set query_parameters = {
'post_type': 'myposttype',
'tax_query': {
'taxonomy': 'portals',
'field': 'term_id',
'terms': '89'
}
}%}
{% set ones = wordpress.call('Timber::get_posts', query_parameters) %}
Upvotes: 1
Views: 813
Reputation: 21
Found out that issue is here I was missing [] as the tax_query is an array!
{% set query_parameters = {
'post_type': 'myposttype',
'tax_query': [{
'taxonomy': 'portals',
'field': 'term_id',
'terms': '89'
}]
}%}
{% set ones = wordpress.call('Timber::get_posts', query_parameters) %}
Upvotes: 1