<p>The <code>relatedTo</code> parameter accepts an element, the ID of an element, an array if element ids or an object of type <code>EntryQuery</code>.</p>

<p>All you need to do is to pass the ID rather than the title</p>

<pre><code>targetElement: entry.id
</code></pre>

<p>Furthermore if you use Craft 3 you might want to execute your query by calling <code>.all()</code>
<code>talents</code> doesn't contain an array. It contains an object of type <code>EntryQuery</code> that can be executed in order to get an array of elements </p>

CC BY-SA 4.0
2018-08-18T17:17:48.253Z
2018-08-18T17:23:12.110Z
2018-08-18T17:23:12.110Z
Robin Schambach
<p>I want to get list of entries in my section <code>video</code> related to my current entry</p>

<pre><code>{% for video in craft.entries.section('videos').limit('3').relatedTo({targetElement: entry.title, field: 'talents'}) %}
</code></pre>

<p>problem is <code>entry.title</code> is text, but talents is array.</p>

<relatedto>
Question about "relatedTo"
# Question about "relatedTo"

(Asked by: username_0 on 2018-08-18)

I want to get list of entries in my section video related to my current entry
{% for video in craft.entries.section('videos').limit('3').relatedTo({targetElement: entry.title, field: 'talents'}) %}

problem is entry.title is text, but talents is array.

**Tags:** relatedto


---

## 1 answers

### Answer by username_1 on 2018-08-18. Score: 2

The relatedTo parameter accepts an element, the ID of an element, an array if element ids or an object of type EntryQuery.
All you need to do is to pass the ID rather than the title
targetElement: entry.id

Furthermore if you use Craft 3 you might want to execute your query by calling .all()
talents doesn't contain an array. It contains an object of type EntryQuery that can be executed in order to get an array of elements


---

