# Extend panel search

**URL:** <https://forum.getkirby.com/t/extend-panel-search/33868>\
**Category:** Questions\
**Tags:** v4\
**Created:** [March 28, 2025, 4:22pm UTC](https://forum.getkirby.com/t/extend-panel-search/33868 "2025-03-28T16:22:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![roland\_dreger](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@roland\_dreger](https://forum.getkirby.com/u/roland_dreger)\
**Post date:** [March 28, 2025, 4:22pm UTC](https://forum.getkirby.com/t/extend-panel-search/33868/1 "2025-03-28T16:22:16Z")

</div>

Hi all,

I am currently testing [this code snippet](https://getkirby.com/docs/reference/plugins/extensions/panel-search#extending-default-search-types) to extend the default panel search.

```auto
Kirby::plugin('example/search', [
  'areas' => [
    // extending a core search
    'site' => function ($kirby) {
      return [
        'searches' => [
          'pages' => [
            'query' => function (string $query) use ($kirby) {

              if (!$kirby->user()->isAdmin()) {
                // return only child pages of a page (via specified UUID)
              }

              return $kirby->core()->area('site')['searches']['pages']['query']($query);
            }
          ]
        ]
      ];
    },
  ]
]);

```

However, “no result” appears in the search panel. How do you return the unchanged search results?

Background: I would like to customize the panel search so that the search is limited to different pages and their subpages for the user roles editor and reviewer.

Roland

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [March 31, 2025, 6:57pm UTC](https://forum.getkirby.com/t/extend-panel-search/33868/2 "2025-03-31T18:57:39Z")

</div>

Thank you, seems you spotted a mistake in the docs. It should be

```php
'query' => function (string|null $query, int $limit, int $page) use ($kirby) {
	// ...

	return $kirby->core()->area('site')['searches']['pages']['query']($query, $limit, $page);
}

```

For your custom results, best to check [kirby/config/areas/site/searches.php at main · getkirby/kirby · GitHub](https://github.com/getkirby/kirby/blob/main/config/areas/site/searches.php) to see what you need to return.

---

<div class="post-metadata">

**Author:** ![roland\_dreger](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@roland\_dreger](https://forum.getkirby.com/u/roland_dreger)\
**Post date:** [March 31, 2025, 7:20pm UTC](https://forum.getkirby.com/t/extend-panel-search/33868/3 "2025-03-31T19:20:48Z")

</div>

> [@distantnative](#):
>
> ```auto
> 'query' => function (string|null $query, int $limit, int $page) use ($kirby) {
> // ...
> 
> return $kirby->core()->area('site')['searches']['pages']['query']($query, $limit, $page);
> }
> 
> ```

So it works perfectly, thanks for the answer and the link!
