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?

  • If I'm following you correctly, are the related tags in a Craft Tag field or are they an Entries field?
    – Brad Bell
    Sep 24 '19 at 0:15
  • tags are in a Craft Tag Field, as far as I understand Sep 24 '19 at 10:25
  • 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() Sep 24 '19 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.