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
There seems to be an issue with the relatedTo query param in Craft 3. When I try to get all categories/tags related to the entries from one section, the categories/tags are displayed multiple times. Specifically, the categories/tags are displayed for each entry they've been assigned to. The desired behaviour would be each category/tag is only output once, right?
Steps to reproduce
Create a few entries in a section and assign categories to them. Make sure to assign one category to multiple entries.
Put the following code into a template:
{% set posts = craft.entries.section('sectionHandle').limit(null) %}
{% set categories = craft.categories.relatedTo(posts) %}
{% for category in categories %}
{{ category.title }}
{% endfor %}
The title of a category will appear for each post it's been assigned to, i.e. multiple times. It should only appear once, right?
Additional info
Craft version: Craft 3-beta.12
PHP version: 7.1.4
Database driver & version: MySQL 5.7.17
Plugins & versions: Element Api 2.0.1
The text was updated successfully, but these errors were encountered:
Description
There seems to be an issue with the
relatedTo
query param in Craft 3. When I try to get all categories/tags related to the entries from one section, the categories/tags are displayed multiple times. Specifically, the categories/tags are displayed for each entry they've been assigned to. The desired behaviour would be each category/tag is only output once, right?Steps to reproduce
Additional info
The text was updated successfully, but these errors were encountered: