title: What is the best way to handle redirects in WordPress using Timber and Twig?
body: <p>I would like to redirect the author, category and tag pages to my home page.
  In Yoast SEO I have set these pages to not be indexed, but I want them to actually redirect permanently to the home page.</p>
  <p>I tried the following code in functions.php but it had no effect:</p>
  <pre><code>// Redirect all author archives to the website's about page
  add_filter('author_link', 'ehi_author_link');
  function ehi_author_link()
  {
      return home_url('home');
  }
  </code></pre>
  <p>or</p>
  <pre><code>add_action('template_redirect', 'my_custom_disable_author_page');
  
  function my_custom_disable_author_page() {
      global $wp_query;
  
      if ( is_author() ) {
          // Redirect to homepage, set status to 301 permenant redirect.
          // Function defaults to 302 temporary redirect.
          wp_redirect(get_option('home'), 301);
          exit;
      }
  }
  </code></pre>