Twig+ Wordpress - How to pass array arguments to function?
Twig works more or less like plain PHP. For a function call you add parameters like you would in PHP:
{{ method(parameter1, parameter2) }}
Arrays can be defines using [
and ]
. Also associative arrays can be defined using {
and }
like this:
{% set array = [1, 2, 3] %}{% set assoc = {'key': 'value', 'key2': 2} %}
So your function call should look something like this:
{% for distrito in wp.get_terms('Distritos', ['a', 'b', 'c']) %}
Checkout the twig docs for further information.