<p>Calling the following works:</p>
<pre><code>{% set nodes = craft.navigation.nodes().myField('myValue').all() %}
</code></pre>
<p>Obviously, switching out <code>myField</code> with the handle for the field, and <code>myValue</code> with the value you want to check.</p>

CC BY-SA 4.0
2022-09-07T11:26:45.363Z
This actually solves the question. Where can I learn what is going on in this chain of options? I'm not used at all to this format. Is this a Yii2 concept or something specific to CraftCMS? Thanks a lot for your help and for taking the time to test it. (In my tests I was convinced that the value was set because I was looking into the production database while using the dev environment, huge facepalm)
Álvaro Franz
CC BY-SA 4.0
2022-09-07T12:56:07.303Z
This would be a Craft-specific concept, which deals with custom fields. In fact, it's the same for every element in Craft, and any element in plugins. Fortunately, Navigation Node's are elements, which can be queried. More info on elements - https://craftcms.com/docs/4.x/elements.html

As for element queries (which you're doing here) there's some info https://craftcms.com/docs/4.x/element-queries.html#executing-element-queries
crawf
CC BY-SA 4.0
2022-09-07T11:16:17.463Z
2022-10-07T22:32:48.833Z
2022-10-07T22:32:48.833Z
crawf
<p>I wonder if it's possible to query navigation nodes by custom field when using the <a href="https://verbb.io/craft-plugins/navigation/features" rel="nofollow noreferrer">Navigation plugin by Verbb</a>.</p>
<p>I haven't seen it in <a href="https://verbb.io/craft-plugins/navigation/docs/getting-elements/node-queries" rel="nofollow noreferrer">the documentation</a>.</p>
<p>Suppose I have a Navigation menu with a field called <em>whateverField</em>.</p>
<p>I want a query that looks something like:</p>
<pre><code>{% set myQueriedNodes = 
craft.navigation.nodes()
.withField('whateverField).equalTo('whateverValue')
.all() %}
</code></pre>
<p>Do you know if that's possible?</p>
<p>Thanks!</p>

CC BY-SA 4.0
2022-09-07T09:26:55.290Z
Have you tried to query by the registered type?
Max Strebel
CC BY-SA 4.0
2022-09-07T09:57:01.487Z
@MaxStrebel No, but thanks for the hint. Looks like "registered type" means something like the custom post type in Wordpress? Something like "bypass the plugin query options and do it by native craft search"? Thanks!
Álvaro Franz
CC BY-SA 4.0
2022-09-07T10:35:13.890Z
Oh sorry, I thought you meant you want to get nodes which use a custom node type.

Have you tried: `{% set myQueriedNodes = craft.navigation.nodes().whateverField('whateverValue).all() %}`?
Max Strebel
CC BY-SA 4.0
2022-09-07T11:25:31.053Z
@MaxStrebel - Actually, your last comment is the answer to this question. I'm accepting crawf's one. Thank you both for the attention and help.
Álvaro Franz
<navigation><plugin-navigation>
Get Navigation Node by Custom Field
# Get Navigation Node by Custom Field

(Asked by: username_0 on 2022-09-07)

I wonder if it's possible to query navigation nodes by custom field when using the Navigation plugin by Verbb.
I haven't seen it in the documentation.
Suppose I have a Navigation menu with a field called whateverField.
I want a query that looks something like:
{% set myQueriedNodes = 
craft.navigation.nodes()
.withField('whateverField).equalTo('whateverValue')
.all() %}

Do you know if that's possible?
Thanks!

**Tags:** navigation, plugin-navigation
> **Comments:**
> **username_1**: Have you tried to query by the registered type?  
> **username_0**: @MaxStrebel No, but thanks for the hint. Looks like "registered type" means something like the custom post type in Wordpress? Something like "bypass the plugin query options and do it by native craft search"? Thanks!  
> **username_1**: Oh sorry, I thought you meant you want to get nodes which use a custom node type.  Have you tried: `{% set myQueriedNodes = craft.navigation.nodes().whateverField('whateverValue).all() %}`?  
> **username_0**: @MaxStrebel - Actually, your last comment is the answer to this question. I'm accepting crawf's one. Thank you both for the attention and help.  

---

## 1 answers

### Answer by username_2 on 2022-09-07. Score: 1 | Accepted answer

Calling the following works:
{% set nodes = craft.navigation.nodes().myField('myValue').all() %}

Obviously, switching out myField with the handle for the field, and myValue with the value you want to check.

> **Comments:**
> **username_0**: This actually solves the question. Where can I learn what is going on in this chain of options? I'm not used at all to this format. Is this a Yii2 concept or something specific to CraftCMS? Thanks a lot for your help and for taking the time to test it. (In my tests I was convinced that the value was set because I was looking into the production database while using the dev environment, huge facepalm)  
> **username_2**: This would be a Craft-specific concept, which deals with custom fields. In fact, it's the same for every element in Craft, and any element in plugins. Fortunately, Navigation Node's are elements, which can be queried. More info on elements - https://craftcms.com/docs/4.x/elements.html  As for element queries (which you're doing here) there's some info https://craftcms.com/docs/4.x/element-queries.html#executing-element-queries  

---

