1

I have date field in entry that is empty therefore has null value. I'd like to filter entries that have date field value equal to null.

How would I set that parameter on element criteria object? I don't want to achieve it by looping yet because I'm merging entries from another section.


Setting it to null returns entries with or without value.

{% set myEntries = craft.entries.section("mySection").date(null) %}

Setting it to "" returns entries with or without value.

{% set myEntries = craft.entries.section("mySection").date("") %}
2

The special strings :empty: and :notempty: might be what you're looking for. The docs list it only against expiryDate, but I think it's available for any field: https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#expirydate

| improve this answer | |

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.