Disable or control the panel search button?

Have you used api your path?

For example:

   'hooks' => [
        'route:before' => function ($route, $path, $method) {
            if (Str::startsWith($path, 'api/pages/')) {
               
              throw new Exception('no no');
            }
          }
    ]

This should prevent access to any pages. From there, you have to define your logic…

As regards Panel search, it’s probably possible to disable it via the route as well.

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

This still brings up the search but it doesn’t do anything. Together with hiding it, it should also do the job.