<p>For anyone else who happens to land on this trying to solve your similar challenge:</p>
<p>Super simple - the criteria can accept a custom field value, so in my case, the criteria became</p>
<pre><code>'criteria' =&gt; [
    'section' =&gt; 'caseOfTheMonth',
    'type' =&gt; 'standard',
    'hideFromFeed' =&gt; false,
],
</code></pre>
<p>What was getting in the way, in my case, was that I was fighting the Element API response cache when I was trying all my options, so I completely missed the most simple solution. That's my takeaway - manage that cache when testing!</p>

CC BY-SA 4.0
2021-07-19T20:46:38.283Z
2021-07-19T21:36:45.960Z
2021-07-19T21:36:45.960Z
Alan Kimrey
<p>I'm trying to exclude an entry based on the state of a lightswitch field in the entry itself. If true, exclude the entry from the feed, if false include the entry.</p>

CC BY-SA 4.0
2021-07-19T06:45:12.683Z
Hi Alan. It would help us help you if you explained what you tried already.
nstCactus
<element><api>
Element API - lightswitch option to exclude an entry from a feed
# Element API - lightswitch option to exclude an entry from a feed

(Asked by: username_0 on 2021-07-16)

I'm trying to exclude an entry based on the state of a lightswitch field in the entry itself. If true, exclude the entry from the feed, if false include the entry.

**Tags:** element, api

> **Comments:**
> **username_1**: Hi Alan. It would help us help you if you explained what you tried already.  

---

## 1 answers

### Answer by username_0 on 2021-07-19. Score: 1

For anyone else who happens to land on this trying to solve your similar challenge:
Super simple - the criteria can accept a custom field value, so in my case, the criteria became
'criteria' => [
    'section' => 'caseOfTheMonth',
    'type' => 'standard',
    'hideFromFeed' => false,
],

What was getting in the way, in my case, was that I was fighting the Element API response cache when I was trying all my options, so I completely missed the most simple solution. That's my takeaway - manage that cache when testing!


---

