Disable panel search in Kirby 3.7.x


I used this code trick to disable the panel search but it doesn’t work anymore with Kirby 3.7.x probably because the search engine has been changed with the new Kirby version.

'hooks' => [
        'route:before' => function ($route, $path, $method) {
            if ($path === 'api/site/search') {
              throw new Exception('no no');

What is the new path to disable the panel search in Kirby >= 3.7?

I just checked what I get when I hit search, and the path for pages looks like this:







Did this change from 3.6 to 3.7?

But I don’t think this will work by blocking the path anymore, because this brings up the Whoops error page.

I actually meant the path indicated in this line: if ($path === 'api/site/search')
I thought it had changed with version 3.7 since panel search deactivation no longer works

Yes, I know what you mean. That’s why I asked if this route worked in 3.6. I can’t see any changes regarding the search or a remove route in 3.7 particularly.

Ok I’ll do some more tests, maybe it’s something from my installation.
I’ll be back later with the results of my tests

I made some tests on the plainkit and this piece of code:


'hooks' => [
        'route:before' => function ($route, $path, $method) {
            if ($path === 'api/site/search') {
              throw new Exception('no no');

… disable the search engine in the panel until the version 3.5.8 of Kirby but it stop working from the version 3.6.0

Ok, that makes more sense. Because with the introduction of Panel areas, the way search works in the Panel has changed. As I wrote above, if you look at the networks tab while executing search, you will see the URLs called that I posted above.

Edit: It should be able to overwrite the search, see Panel search | Kirby CMS, but as far as I recall it’s not possible to set this to false somehow, but can’t really remember, not even if I created an issue somewhere, poor :brain:

I made a plugin to extend the search engine and prevent “traveller” role to find pages in my application. It works but in my case it would be even better to prevent traveller role to open the search input. I’ve hidden the search icon in the panel with CSS but the user can always click by accident and open the search input.

So now I try to intercept the click event on the panel search button with JS in a custom-panel.js file to prevent the user to open the search input.

But the panel is a Single Page Application and load the panel page on <div id="app"></div> so something like …


… return nothing

I’m not an expert in SPA architecture and VueJS so I don’t know how to access to DOM element in the panel via my custom-panel.js file? Is there a solution?

Ho, I’ve just found a solution in pure CSS:

pointer-events: none;

But I’m still curious to know how we can get panel DOM element throught a custom-panel.js file

I think you’ve already found the easiest solution.

You would have to override the k-topbar component, copy/pasting its whole template, but leaving the search button out. But I don’t think that would be worth the effort.

I think having a search permission by role might actually be an idea. Or at least add a search-button class or something to the button so that you simply could hide the whole button instead of only its icon. Maybe a feature request on nolt could be worth it.

In the meantime, you could try with this:

.k-topbar-signals > button:last-of-type {
  display: none;

Thanks for your explanation. Feature request on nolt done !