1

By default eager loading only returns live entries. Is it possible to grab expired only.

I've got this... But I only want expired relatedVenue:

{% set ideas = craft.entries().section('ideas').with(['stListicles', 'stListicles.relatedVenue']) %}

Possible?

I've already tried this:

{% set ideas = craft.entries().section('ideas').status('live').with([
    'stListicles',
    ['stListicles.relatedVenue', { status: 'expired, disabled, pending' }]
]) %}

1 Answer 1

1

Assuming this is an Entries field in a Matrix block, the syntax is:

{% set ideas = craft.entries()
    .section('ideas')
    .status('live')
    .with([
        ['matrixField.blockType:entriesField', { status: ['not', 'live'] }]
    ])
    .all() %}

Change matrixField.blockType:entriesField to match your fields, of course :)

Documentation is here - https://craftcms.com/docs/3.x/dev/eager-loading-elements.html#eager-loading-elements-related-to-matrix-blocks

1

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.