title: Twig_Error_Syntax for "Unknown filter" with a Twig filter in Timber
body: <p>This has got to be simple, but I can't see what's wrong. I'm using the simple filter example at <a href="https://twig.symfony.com/doc/1.x/advanced.html#filters" rel="nofollow noreferrer">https://twig.symfony.com/doc/1.x/advanced.html#filters</a> with Twig 1.34 in Timber, a WordPress plugin.</p>
  
  <p>I added</p>
  
  <pre><code>// an anonymous function
  $filter = new Twig_SimpleFilter('rot13', function ($string) {
      return str_rot13($string);
  });
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$twig = new Twig_Environment($loader);
  $twig-&gt;addFilter($filter);
  </code></pre>
  
  <p>to my theme's functions.php file.</p>
  
  <p>But using <code>{{ 'Twig'|rot13 }}</code> in my view.twig file gives a fatal error</p>
  
  <pre><code>PHP Fatal error:  Uncaught exception 'Twig_Error_Syntax'
  with message 'Unknown "rot13" filter' in view.twig
  </code></pre>
  
  <p>and a notice</p>
  
  <pre><code>Undefined variable: loader in functions.php
  </code></pre>
  
  <p>Using a filter like <code>{{ 'Twig'|lower }}</code> works OK.</p>
  
  <p>Do I need to add the functions to functions.php in a different way?</p>