For instance, if I wanted an array of all the titles belonging to a subset of entries that I wish to query. The way I know how to do this currently is like so:

  {% set titleList = [] %}
  {% articleQuery = craft.entries().section('articles') %}
  {% for article in articleQuery.all() %}
    {% set titleList = titleList|merge([article.title]) %}
  {% endfor %}

The other way I can think of to do this operation is with the map twig filter, but I'm wondering if there is a way to query for such a field-value list straight away and avoid spending computational time on iterations.

1 Answer 1


Yep! It's not super well documented, but there's a little information about it down in the Advanced Element Queries section of the docs. It would look something like:

  {% set titleList = craft.entries.section('articles').select('title').column() %}

One thing to note, if you're selecting a field value instead of the title, the select parameter will look something like select('field_fieldHandle')

  • 1
    You answered my question exactly, but in case anyone is interested in an after-the-query way to dice up their objects, the column filter seems like a great option because you can even pass a function for extra logic. craftcms.com/docs/3.x/dev/filters.html#column
    – Brimby
    Oct 18, 2020 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.