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. *