1

A Craft (3.4 Pro) website has setup two sites, one for each language. There are entries in a section that are enabled and others that are disabled for each language.

I want to get a list of all the entries, regardless of whether they are enabled or not.

I know there is a enabledForSite parameter but this can be set to either true or false but not both.

For example the query below returns only enabled entries.

{% set items = craft.entries({
  section: 'works',
  enabledForSite: true,
  status: [
    'live', 'pending', 'disabled', 'expired'
  ]
}).all() %}

How can I get a list that contains both enabled and disabled entries?

2

With the help of Oli from Craft, it turns out the solution is simpler than I thought:

{% set items = craft
    .entries()
    .section('works')
    .anyStatus()
    .all() 
%}

This returns all entries, enabled and disabled.

| improve this answer | |
0

From a quick look at the code, I think you can pass enabledForSite: [true, false] to get both the enabled and disabled entries. So in your case:

{% set items = craft.entries({
  section: 'works',
  enabledForSite: [true, false],
  status: [
    'live', 'pending', 'disabled', 'expired'
  ]
}).all() %}
| improve this answer | |
  • Thank you for answering! However I tried this and it doesn't work. I still get the same results (enabled entries) – Panos Spiliotis Jul 17 at 13:06

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.