<p>I'm working on Craft plugin which should find entries with special tags.
In my action I have a string:</p>

<pre><code>$entries = Entry::find()-&gt;section('Projects')-&gt;type(['Projects']);
</code></pre>

<p>and it returns all entries that I should get. But I also need related to this entries tags.</p>

<p>Something like this:</p>

<pre><code>foreach ($entries as $entry) {
    $tags[] = $entry-&gt;getRelatedTags();
}
</code></pre>

<p>But this doesn't work :)</p>

<p>Could anybody help get related to entry tags for entry? </p>

CC BY-SA 4.0
2019-09-24T00:15:01.680Z
If I'm following you correctly, are the related tags in a Craft Tag field or are they an Entries field?
Brad Bell
CC BY-SA 4.0
2019-09-24T10:25:30.567Z
tags are in a Craft Tag Field, as far as I understand
Anton Zhavrid
CC BY-SA 4.0
2019-09-24T11:25:07.107Z
so. good question is half of answer :) . thanks Brad. this tags was usual fields. and we can handle it as usual fields. for example for tag **location**
`$entry->location->find(`)
Anton Zhavrid
<tags>
get tags related to entry
# get tags related to entry

(Asked by: username_0 on 2019-09-23)

I'm working on Craft plugin which should find entries with special tags.
In my action I have a string:
$entries = Entry::find()->section('Projects')->type(['Projects']);

and it returns all entries that I should get. But I also need related to this entries tags.
Something like this:
foreach ($entries as $entry) {
    $tags[] = $entry->getRelatedTags();
}

But this doesn't work :)
Could anybody help get related to entry tags for entry?

**Tags:** tags
> **Comments:**
> **username_1**: If I'm following you correctly, are the related tags in a Craft Tag field or are they an Entries field?  
> **username_0**: tags are in a Craft Tag Field, as far as I understand  
> **username_0**: so. good question is half of answer :) . thanks Brad. this tags was usual fields. and we can handle it as usual fields. for example for tag **location** `$entry->location->find(`)  

---

## 0 answers

