diff --git a/src/Templates.php b/src/Templates.php index 2dbd4d1..dde097a 100644 --- a/src/Templates.php +++ b/src/Templates.php @@ -128,6 +128,10 @@ 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. *