FilterBy Multiselect categories only works with one selection

I’m sure there’s a real easy way to fix this, but I can’t for some reason!

say I have 3 pages with categories selected through a multiselect field:

Page 1: catgeory1, category2, category3
Page 2: category1, category 3
Page 3: category1

And I do a filterBy:
<?php
if ($category = param(‘category’)) {
$projects = $projects->filterBy(‘category’, $category);
}

and the url is /category:category1

The list only comes up as:

  • Page 3

How can I broaden the scope so that the param matches any of the categories rather than matching exactly the selected categories?

You have to use separator param like that

$projects->filterBy(‘category’, $category, ',');

doi! of course