0
votes

I'm trying to retrieve terms using Timber get_terms with ACF meta_query but it's returning no results. Commenting out the meta_query works however. Am I missing something here?

The ACF field name is 'status' and I am using type True / False.

$context['categories'] = Timber::get_terms('category', array(
    'hide_empty' => 1,
    'exclude' =>  1,
    'meta_query'    => array(
        array(
            'key'       => 'status',
            'value'     => '1',
            'compare'   => '=',
        )
    )
));
{% for item in categories %}
<a class="navbar-item" href="{{ item.link }}">{{ item.title }}</a>
{% endfor %}

Thanks.

1

1 Answers

0
votes

Why not use the top-level parameters?

$context['categories'] = Timber::get_terms('category', array(
    'hide_empty' => 1,
    'exclude' =>  1,
    'meta_key' => 'status',
    'meta_value' => '1',
    'meta_compare' => '=',
));