Multiple taxonomies on taxonomy_term loop

I’m trying to use

<Loop type=taxonomy_term taxonomy="category,post_tag" post=current> <Field title /> </Loop>

to display a list of terms for the current post from several taxonomy. Is that possible ?
Thank you :slight_smile:

Randomly, did you try taxonomy_relation="and" to manage multiple taxonomies in the loop?
I know it’s for the Post loop in the doc but it might worth testing:

1 Like

Currently, the taxonomy term loop only supports querying by a single taxonomy.

Looking into it, this loop type uses WP_Term_Query which can accept multiple taxonomies.

taxonomy - string|string[] - Taxonomy name, or array of taxonomy names

I’ve made a note as a feature request.


In the meantime, you can probably achieve it using List.

Create an empty list.

<List name=ids></List>

Add post tags to the list.

<Loop taxonomy=post_tag post=current>
  <List name=ids push>
    <Item><Field id /></Item>
  </List>
</Loop>

Add categories to the list.

<Loop taxonomy=category post=current>
  <List name=ids push>
    <Item><Field id /></Item>
  </List>
</Loop>

Loop through the list of taxonomy terms, optionally ordering by name, etc.

<Loop type=taxonomy_term id="{Get list=ids}" orderby=name>
  ..Every tag or category..
</Loop>
1 Like