Multiple and or relatedTo in plugin element criteria I am trying to return entries that relate to a series of categories.

For example, I am trying to return clothing, in this example, I want to return all entries related to (flannel or denim) and (blue or red) in the products channel.

Flannel, denim, blue and red are all apart of the same category group called: filters, and the category field handle is productFilters

I was trying to return all those entries but it returns 0 entries, any help is appreciated. I know I can do this probably using the craft cms element query in the template but I need to do this in a plugin.

$color_categories = craft()-&gt;elements-&gt;getCriteria(ElementType::Category, [
    'slug'  =&gt; ['blue', 'red'],
    'group' =&gt; 'filters'
])-&gt;find();

$fabric_categories = craft()-&gt;elements-&gt;getCriteria(ElementType::Category, [
    'slug'  =&gt; ['denim', 'flannel'],
    'group' =&gt; 'filters'
])-&gt;find();

$entries = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry, [
    'section'           =&gt; 'products',
    'relatedTo'         =&gt; ['and', $fabric_categories, $color_categories],
]);

return $entries;
Aren't you missing the -&gt;find() on the last bit?

$entries = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry, [
    'section'           =&gt; 'products',
    'relatedTo'         =&gt; ['and', $fabric_categories, $color_categories],
])-&gt;find();
return $entries;