Skip to content

Commit 5f64ef7

Browse files
committed
New .notRelatedTo() relational query method
1 parent 725c972 commit 5f64ef7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/5.x/system/relations.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,18 @@ Use the `andRelatedTo` parameter to join multiple sets of relational criteria to
142142
There is one limitation, here: multiple `relatedTo` criteria using `or` *and* `and` operators cannot be combined.
143143
:::
144144

145+
### The `notRelatedTo` and `andNotRelatedTo` Parameters
146+
147+
Find entries that _aren’t_ related to one or more elements with the `not*` relational query methods. This can be combined with the `relatedTo` parameter.
148+
149+
```twig{3-4}
150+
{% set ketoRecipes = craft.entries()
151+
.section('recipes')
152+
.relatedTo(fish)
153+
.notRelatedTo(gluten)
154+
.all() %}
155+
```
156+
145157
## Simple Relationships
146158

147159
The most basic relational query involves passing a single element or element ID. Here, we’re looking up other recipes that use the current one’s main protein:

0 commit comments

Comments
 (0)