# filterBy() in route

**URL:** <https://forum.getkirby.com/t/filterby-in-route/18684>\
**Category:** Questions\
**Tags:** v3\
**Created:** [July 2, 2020, 8:26am UTC](https://forum.getkirby.com/t/filterby-in-route/18684 "2020-07-02T08:26:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexpi](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alexpi/32/12008_2.png) [@alexpi](https://forum.getkirby.com/u/alexpi)\
**Post date:** [July 2, 2020, 8:26am UTC](https://forum.getkirby.com/t/filterby-in-route/18684/1 "2020-07-02T08:26:40Z")

</div>

I want to filter a page collection inside a route. My code:

```php
[
'pattern' => 'categories/(:alpha)/filter',
'action' => function($category) {
  $items = page('items')->children()->listed()->filterBy('category', $category);
]

```

`page('items')->children()->listed()` returns the pages I want, but the filtering by the ‘category’ field is not happening. How can I solve this?

---

<div class="post-metadata">

**Author:** ![sebastiangreger](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/sebastiangreger/32/16176_2.png) [@sebastiangreger](https://forum.getkirby.com/u/sebastiangreger)\
**Post date:** [July 2, 2020, 8:44am UTC](https://forum.getkirby.com/t/filterby-in-route/18684/2 "2020-07-02T08:44:27Z")

</div>

Possibly: `filterBy('category', $category, ',')`

---

<div class="post-metadata">

**Author:** ![alexpi](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alexpi/32/12008_2.png) [@alexpi](https://forum.getkirby.com/u/alexpi)\
**Post date:** [July 2, 2020, 8:53am UTC](https://forum.getkirby.com/t/filterby-in-route/18684/3 "2020-07-02T08:53:10Z")

</div>

I found the problem, the ‘category’ field in the content files and $category are in different languages. Sorry!
