You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/5.x/system/relations.md
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -142,6 +142,18 @@ Use the `andRelatedTo` parameter to join multiple sets of relational criteria to
142
142
There is one limitation, here: multiple `relatedTo` criteria using `or`*and*`and` operators cannot be combined.
143
143
:::
144
144
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
+
145
157
## Simple Relationships
146
158
147
159
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