From 9ee6e16f91de6b737de8d0bfec273382b8f09f6b Mon Sep 17 00:00:00 2001 From: Menno van den Ende <50165380+menno-ll@users.noreply.github.com> Date: Wed, 2 Sep 2026 13:47:45 +0200 Subject: [PATCH] add twig cache --- lib/clarkson-core-templates.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/clarkson-core-templates.php b/lib/clarkson-core-templates.php index 111f2fc..ca15e16 100644 --- a/lib/clarkson-core-templates.php +++ b/lib/clarkson-core-templates.php @@ -139,6 +139,11 @@ private function get_twig_environment( array $template_dirs ):\Twig\Environment 'debug' => $debug, ); + if ( wp_get_environment_type() === 'production' ) { + $version = wp_get_theme()->get( 'Version' ) ?: 'no-version'; + $twig_args['cache'] = sys_get_temp_dir() . '/cache/twig/' . $version . '/'; + } + /** * Allows manipulation of the twig envirionment settings. *