$controllers */ protected function rest(array $controllers): void { add_action('rest_api_init', static function () use ($controllers) { foreach ($controllers as $controller) { (new $controller())->register_routes(); } }); } /** Run a callback only in the admin context (where the React screens live). */ protected function admin(callable $fn): void { if (is_admin()) { $fn(); } } }