<p>You would first query for all active categories and then get the Product entries that are related to these categories.</p>

<pre><code>{% set allCategories = craft.categories.group('Categorie') %}
{% set entriesWithActiveCategories = craft.entries.section('Products').relatedTo(allCategories) %}
</code></pre>

CC BY-SA 3.0
2015-01-23T16:59:12.750Z
2015-01-23T16:59:12.750Z
carlcs
<p>In the product overviews and search results on my website are also products listed which are related to passive categories.
Is there a way to get only entries which are related to active categories?
<img src="https://i.sstatic.net/otOiL.png" alt="The product with this category status should not be displayed at the website"></p>

<p>The product with this category status should not be displayed at the website</p>

<entries><categories><status>
How can I only get the entries that are related to an active category
# How can I only get the entries that are related to an active category

(Asked by: username_0 on 2015-01-23)

In the product overviews and search results on my website are also products listed which are related to passive categories.
Is there a way to get only entries which are related to active categories?
![The product with this category status should not be displayed at the website](https://i.sstatic.net/otOiL.png)

The product with this category status should not be displayed at the website

**Tags:** entries, categories, status


---

## 1 answers

### Answer by username_1 on 2015-01-23. Score: 4 | Accepted answer

You would first query for all active categories and then get the Product entries that are related to these categories.
{% set allCategories = craft.categories.group('Categorie') %}
{% set entriesWithActiveCategories = craft.entries.section('Products').relatedTo(allCategories) %}


---

