I am trying to get a random entry which has the quote matrix field populated.

I've tried this:

{% set entry = craft.entries.section('entries').quote(':notempty:').order('RAND()').limit(1) %}

That isn't working. What do I need to do?


Currently the only way to find entries that have Matrix rows is with the search param:

{% set entry = craft.entries.section('entries').search('quote:*').order('RAND()').limit(1) %}
  • is this true for craft 3 as well?
    – outline4
    Sep 26 '19 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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